ese-msc / introduction-to-python

"Introduction to Python" course for future Imperial College London MSc students
BSD 3-Clause "New" or "Revised" License
71 stars 83 forks source link

Possible mistake in the assertions about the angles of the Triangle class #91

Open esemsc-df329480 opened 2 days ago

esemsc-df329480 commented 2 days ago

Dear Dr Beg,

Some assertions made about the angles() method of the Triangle class in lecture 5 are possibly wrong, because they don't agree with the specification for the method.

add a method to the Triangle class called angles(). It should return a tuple of three floats, each representing the interior angle in radians of the vertices of the triangle, ordered so that the first angle is at the first vertex of the triangle, and so on.

However, in the assertions, it appears that the angles of the first and second vertices are accidentally swapped. sc1

I appreciate your time into this issue in advance.

Yours truly, esemsc-df329480 (Guanyuming He)

esemsc-df329480 commented 2 days ago

Dear Dr Beg,

It just occurred to me that perhaps you wanted each angle to correspond to an edge, instead of a vertex. Nevertheless, there's some inconsistency with the specification.

marijanbeg commented 1 day ago

Hi @esemsc-df329480, thank you for letting us know. I agree with you that the problem description is a bit vague and can be understood differently. Would you like to suggest to us how you would formulate that question and we can consider including it for the next cohort?

esemsc-df329480 commented 1 day ago

Dear Dr Beg,

I think your description is good and clear. According to it, the first angle, angles()[0], should be the one at the first vertex, $(0,0)$; and it should be $\pi/2$. The problem is that $\pi/2$ is asserted to be angles()[1] instead.

With that said, however, since each vertex is assigned a name in __init__ ($a$, $b$, and $c$), I can think of a way to make the statement 100% accurate, using mathematical language. For example, we could rephrase the specification of angles() to:

The angles() method should return the tuple $(\angle cab, \angle abc, \angle bca)$, in radians.

Cheers. :)

marijanbeg commented 1 day ago

That's a great suggestion. Alternatively, we can adjust the tests so it does not matter what the order of the angles in the tuple is.

Thank you! I will leave this issue open to remind us to update the materials.