InterviewSolution
| 1. |
Write a menu driven program to find the perimeter of square ,rectangle, or circumference of a circle # best ans will marked brainlist |
|
Answer» PYTHON ANSExplanation:print("CHOICE 1: Area of Circle")print("Choice 2: Perimeter of SQUARE")print("Choice 3: Perimeter of Rectangle") print("Choice 4: Exit")print("\n")#Defining variableschoice = INT(input("Enter your choice: "))cm = "Circumference/Perimeter is: " areaunit = "Area in square meters: "#Creating choiceswhile True: if choice==4: break print("Thank you for your valuable time. Please do give a FEEDBACK.") elif choice==1: IMPORT math r = float(input("Enter radius of circle: ")) area = (math.pi)*(r)*(2) print(cm) print(area) print("\n") elif choice==2: import math print("\n") side = int(input("Enter the side of the square: ")) vol = (side*4) print("\n") print(cm) print(vol) print("\n") elif choice==3: import math print("\n") l = int(input("enter length of the rectangle: ")) b = int(input("Enter breadth of the rectangle: ")) print("\n") volcy =2*(l+b) print(volunit) print(volcy) print("\n") #If incorrect/invalid choice is chosen else: print("Invalid choice. Please enter a valid chioce between 1 to 4.") print("\n") breakprint("Thank you for your valuable time. Please do give a feedback.") |
|