Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
AccountDelete M
49 PointsPlease help me not working
#sine rule solver
import math
import numpy
print("Sine Rule Solver")
print("Format for imputting numbers")
print("a/SinA = b/SinB")
print("make sure that you enter in degress")
print("if you don't know that value input 'x'")
a = input("Input a ")
A = input("Input A")
b = input("Input b")
B = input("Input B")
print("you have inputted " + str(a) + " " + str(A) + " " + str(b) + " " + str(B))
a = str(a)
A = str(A)
b = str(b)
B = str(B)
if (a == "x"):
A = int(A)
b = int(b)
B = int(B)
print("a = " + str((b/math.sin(math.radians(B))*math.sin(math.radians(A)))))
if (A == "x"):
a = int(A)
b = int(b)
B = int(B)
print("A = " + str(numpy.arcsin(math.radians(a/(b/math.sin(math.radians(B)))))
if (b == "x"):
A = int(A)
a = int(b)
B = int(B)
print("b = " + str((a/math.sin(math.radians(A))*math.sin(math.radians(B)))))
if (B == "x"):
A = int(A)
b = int(b)
a = int(B)
print("B = " + str(numpy.arcsin(math.radians(b/(a/math.sin(math.radians(A)))))
AccountDelete M
49 Pointspls help
Steve Hunter
57,712 PointsThis looks like homework - what's the question; what does your code do; what should it do; what errors are you receiving that you weren't expecting?
The Treehouse community is happy to help - but we try not to complete homework assignments!
AccountDelete M
49 PointsIt solves the sine rule, u enter the 3 numbers and one x and then it'll solve for you automatically.
1 Answer
Stuart Wright
41,120 PointsI'm not 100% sure what your code is meant to do (has been a while since I studied trigonometry!), but I can at least tell you what syntax errors you need to fix to make your code run. These two lines both need two extra ")" characters on the end. They each have 7 opening "(", but only 5 ")".
print("A = " + str(numpy.arcsin(math.radians(a/(b/math.sin(math.radians(B)))))
print("B = " + str(numpy.arcsin(math.radians(b/(a/math.sin(math.radians(A)))))
AccountDelete M
49 Pointsthanks
Stuart Wright
41,120 PointsStuart Wright
41,120 PointsWould it be possible for you to post this in a more readable format? You can achieve this by surrounding your code in three backtick characters in your post - for example:
You should see a link to a Markdown Cheatsheet on this page which explains in more detail.