import math # Main routine # Initialise variables side_list = ['opposite', 'adjacent', 'hypotenuse'] side_values = [] opp = 0 adj = 0 hyp = 0 theta = 0 # Get angle if avaliable angle_present = input("Is there an interior angle other than 90°? ") if angle_present == 'yes': degree_type = input("Radians or Degrees? ") theta = int(input("What is its value? ")) if degree_type == 'degrees': math.degrees(theta) else: theta = None # Get sides if avaliable for item in side_list: side_known = input(f"Do you have the length of the {item}? ") if side_known == 'yes': side_values.append(int(input("What is its length? "))) else: side_values.append(None) # Save side length data opp = side_list[0] adj = side_list[1] hyp = side_list[2] if opp is not None and adj is not None: hyp = math.sqrt(opp ** 2 + adj ** 2) if hyp is not None and opp is not None: adj = math.sqrt(hyp ** 2 - opp ** 2) if hyp is not None and adj is not None: opp = math.sqrt(hyp ** 2 - adj ** 2)