Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import math
  2.  
  3. opp = 0
  4.  
  5. def start():
  6. print("Welcome to the Calculator!")
  7. while calculate():
  8. pass
  9. result()
  10.  
  11. def calculate():
  12. print("Enter which function you would like to use.")
  13.  
  14. theta = raw_input("Enter angle theta: ")
  15. hyp = raw_input("Enter hypotenuse: ")
  16.  
  17. theta = float(theta)
  18. theta = math.radians(theta)
  19.  
  20. hyp = float(hyp)
  21.  
  22. opp = math.sin(theta) * hyp
  23. return opp
  24.  
  25.  
  26. def result():
  27. print(opp)
  28.  
  29. def calculateAgain():
  30. answer = raw_input("Would you like to calculate something again? y/n: ")
  31. if answer in ("y", "Y", "yes", "Yes"):
  32. return answer
  33. elif answer in ("n", "N", "no", "No"):
  34. print("Thank you for using the Calculator!")
  35.  
  36. if __name__ == '__main__':
  37. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement