from math import * def monitor_size(d, a1, a2): Hp = sqrt(a1**2 + a2**2) sinA = a1 / Hp sinB = a2 / Hp width = (d / sin(pi/2) ) * sinA height = (d / sin(pi/2) ) * sinB return width, height if __name__ == "__main__": # Input section d = float(input("Enter the diagonal: ")) a1 = float(input("Enter the aspect ratio, width part: ")) a2 = float(input("Enter the aspect ratio, height part: ")) # Calculations width, height = monitor_size(d, a1, a2) # Output section print("Width: ", width) print("Height: ", height) print("Area: ", width*height)