[Tutor] Help!
Jos Kerc
joskerc at gmail.com
Sat Jan 26 09:25:43 CET 2013
You are missing a multiplication sign.
Near the end of your formula.
On Fri, Jan 18, 2013 at 1:56 PM, Carpenter, Steven <
Steven.Carpenter at oakland.k12.mi.us> wrote:
> To Whom it May Concern,****
>
> I’m trying to get this code working. *Here’s my question:*****
>
> Consider a triangle with sides of length 3, 7, and 9. The law of cosines
> states that given three sides of a triangle (a, b, and c) and angle C
> between sides a and b: Write Python code to calculate the three angles in
> the triangle.****
>
> *Here’s my code: *
>
> # Calculate the angles in a triangle****
>
> # Imports the Math data****
>
> import math****
>
> # Sets up the different angles with corresponding letters****
>
> # The first angle is a****
>
> a = 3****
>
> # The second angle is b****
>
> b = 7****
>
> # The third angle is c****
>
> c = 9****
>
> # Calculates angle "C"****
>
> print(math.acos(((a**2)+(b**2)-(c**2))/(2(a*b))))****
>
> *Here’s my output:*
>
> Traceback (most recent call last):****
>
> File "E:\Programming\Problem4.py", line 12, in <module>****
>
> print(math.acos(((a**2)+(b**2)-(c**2))/(2(a*b))))****
>
> TypeError: 'int' object is not callable****
>
> ** **
>
> *Steven Carpenter*
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130126/76d85cce/attachment.html>
More information about the Tutor
mailing list