Question
Hello i could use more help with Python programming here is my code the code is still not working I have ask 2 other people
Hello i could use more help with Python programming here is my code the code is still not working I have ask 2 other people for help and they were close however i kept getting traceback my code is supposed to display the image I am using python 3.8.1 shell to input my programs.
I have tried coding different files for the circle and rectangle and it still didn't work.
Here is my code and thank you for helping me
def area(radius): return 3.14*radius*radius def circumference(radius): return 2*3.14*radius
def area(width, length): return width*length def perimeter(width,length): return 2*(length+width) import circle import rectangle while (1 == 1): print (' MENU ') print ('1) Area of a circle') print ('2) Circumference of a circle') print ('3) Area of a rectangle') print ('4) Perimeter of a rectangle') print ('5) QUIT') choice = int(input('Enter your choice: ')); if choice == 1: radius = float(input("Enter the circle's radius: ")); print ('The area is ',circle.area(radius)) elif choice == 2: radius = float(input("Enter the circle's radius: ")); print ("The circumference is ",circle.circumference(radius)) elif choice == 3: width = float(input("Enter the rectangle's width: ")); height = float(input("Enter the rectangle's height: ")); print ('The area is ',rectangle.area(width,height)) elif choice == 4: width = float(input("Enter the rectangle's width: ")); height = float(input("Enter the rectangle's height: ")); print ('The perimeter is ',rectangle.perimeter(width,height)) elif choice == 5: print("Exiting the program...") break
> > RESTART MENU 1) Area of a circle 2) Circumference of a circle 3) Area of a rectangle 4) Perimeter of a rectangle 5) Quit Enter your choice: 1 Enter the circle's radius: 2.5 The area is 19.6349540849 MENU 1) Area of a circle 2) Circumference of a circle 3) Area of a rectangle 4) Perimeter of a rectangle 5) Quit Enter your choice: 2 Enter the circle's radius: 2.5 The circumference is 15.7079632679 MENU 1) Area of a circle 2) Circumference of a circle 3) Area of a rectangle 4) Perimeter of a rectangle 5) Quit Enter your choice: 3 Enter the rectangle's width: 4 Enter the rectangle's length: 5 The area is 20.0 MENU 1) Area of a circle 2) Circumference of a circle 3) Area of a rectangle 4) Perimeter of a rectangle 5) Quit Enter your choice: 4 Enter the rectangle's width: 4 Enter the rectangle's length: 5 The perimeter is 18.0 MENU 1) Area of a circle 2) Circumference of a circle 3) Area of a rectangle 4) Perimeter of a rectangle 5) Quit Enter your choice: 5 Exiting the program... Ln: 18 Col: 27 Ln: 1 Cor: 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started