#Calculate the area of a user defined circle or triangle option = 0 while option != 3: print "1. Find the area of a triangle." print "2. Find the area of a circle." print "3. Exit program." print "--------------------------------" option = int(raw_input("Select an option: ")) #Area of a triangle if option == 1: base = float(raw_input("Enter the length of the base: ")) height = float(raw_input("Enter the height of the triangle: ")) #Check for valid input if (base < 0) or (height < 0): print "You must enter non-negative values." else: area = .5 * base * height print "The area of the triangle is " + str(area) + "." #Area of a circle elif option == 2: radius = float(raw_input("Enter the radius of the circle: ")) #Check for valid input if (radius < 0): print "You must enter a non-negative value." else: area = 3.14 * radius**2 print "The area of the circle is " + str(area) + "." elif option == 3: print "Exiting Program" #Invalid option else: print "You did not enter a valid option."