I am trying to build a program that finds the angle of a triangle depending on what sides I give it. I have it setup currently so that a user can input what sides they want. But when ever I input a something to give it the side I want it always defualts to the Adjecent and Hypotenuse statment. I am not sure how to fix it. I am new to coding.
from colorama import Fore
import math
Angle = str(input(Fore.GREEN +"What angles do you have? Please Enter the Names of both: "))
Round = int(input(Fore.GREEN +"Enter how many decimal places you want to round to: "))
OppAja = Angle = ["A and O", "a and o" , "AO" , "ao" , "Adjacent and Opposite" , "adjacent and opposite" , "A O" , "a o" , "adjecent opposite" , "Adjecent Opposite" , "O and A" , "o and a" , "OA" , "oa" , "O A" , "o a" , "opposite and adjecent" , "Opposite and Adjacent" , "opposite adjacent" , "Opposite Adjacent"]
OppHyp = Angle = ["OH" , "HO" , "oh" , "ho" ,"O H" , "H O" , "o h" , "h o" , "O and H", "H and O" , "o and h" , "h and o" , "Opposite and Hypotenuse" , "Hypotenuse and Opposite" , "opposite and hypotenuse" , "hypotenuse and opposite" , "Opposite Hypotenuse" , "Hypotenuse Opposite" , "opposite hypotenuse" ,"hypotenuse opposite"]
AjaHyp = Angle = ["AH" , "ah" , "ha" , "HA" , "A H" , "H A" , "a h" , "h a" , "A and H" , "H and A" , "a and h" , "h and a" , "Hypotenuse and Adjecent" , "Adjecent and Hypotenuse" , "adjecent and hypotenuse" , "hypotenuse and adjecent" , "Hypotenuse Adjecent" , "Adjecent Hypotenuse" , "hypotenuse adjecent" , "adjecent hypotenuse"]
if Angle == OppAja:
print("")
A = int(input(Fore.YELLOW + "Enter the Length of the Adjacent: "))
print("")
O = int(input(Fore.RED+ "Enter the Length of the Opposite: "))
print("")
#Finding the angle of A "Using Tan"
AO = O/A
Tan = math.degrees(math.atan(AO))
print(Fore.LIGHTCYAN_EX + "The Angle is:", round(Tan, Round))
elif Angle == OppHyp:
H = int(input(Fore.LIGHTMAGENTA_EX +"Enter the Length of the Hypotenuse: "))
print("")
O = int(input(Fore.RED +"Enter the Length of the Opposite: "))
#Finding the angle of O "Using Sin"
OH = O/H
Sin = math.degrees(math.sin(OH))
print("")
print("The Angle is: ", round(Sin, Round))
print("")
elif Angle == AjaHyp:
A = int(input(Fore.YELLOW +"Enter the Length of the Adjacent: "))
print("")
H = int(input(Fore.LIGHTMAGENTA_EX +"Enter the Length of the Hypotenuse: "))
#Finding the angle of H "Using Cos"
AH = A/H
Cos = math.degrees(math.cos(AH))
print("The angle is: ", round(Cos, Round))
If anyone can help me that will be much appriciated!
Graeson Christie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.