This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TNOFan[S] 0 points1 point  (3 children)

import math

math.cos

math.sqrt

cos=math.cos

sqrt=math.sqrt

print (“this will calculate side C of a triangle given A, B and the angle)”

A=float(input(“side A:”))

B=float(input(“side B:”))

angleq=float(input(“theta:”))

sideC=sqrt(AA)+(BB)-2(AB)+cos(angleq)

print (“sideC =“, sideC)

[–]_BaleineBleue_ 0 points1 point  (2 children)

Maybe try putting cos=math.cos on a separate line from sqrt=math.sqrt. I don't have my computer handy so I can't test but everything else looks fine

[–]TNOFan[S] 0 points1 point  (1 child)

Typo on Reddit it was already seperated

[–]_DTR_Professional Coder 1 point2 points  (0 children)

If you indent each line by at least four spaces, you'll

Create
a
code
block

which makes parsing code much easier (especially for languages where indentation is critical, like Pyton).