I’ve been thinking that a good way to introduce program design might involve
objects of type Triangle, i.e. instances of the Triangle class.
>>> mytri = Triangle(3,4,5)
>>> mytri.area
6.0
>>> mytri.C
90.0
Now isn’t it true that 3 sides uniquely determine a triangle *except* some
triangles have ha
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Kirby Urner
> Sent: Friday, August 19, 2005 8:30 PM
> To: edu-sig@python.org
> Subject: [Edu-sig] Design patterns
>
> Anyway, here's a design question: do we want to compute the angles and
> store th
Kirby Urner wrote:
> I’ve been thinking that a good way to introduce program design might involve
> objects of type Triangle, i.e. instances of the Triangle class.
> Anyway, here's a design question: do we want to compute the angles and
> store them as properties at the time of construction, i.e.
> Now you can do:
>
> t = Triangle(3,4,5)
> t.c, math.degrees(t.C)
> t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C)
> t.b = t.c = 3
> t.c, math.degrees(t.C)
> t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C)
>
> This takes advantage of the fact that