Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def Square():
- sqlength = int(input("What is the length of the square?: "))
- sqarea = str(round(sqlength*sqlength))
- print("The area of the square is", sqarea)
- def Rectangle():
- rectlength = int(input("What is the length of the rectangle?: "))
- rectwidth = int(input("What is the width of the rectangle?: "))
- rectarea = str(round(rectlength*rectwidth))
- print("The area of the rectangle is", rectarea)
- def Circle():
- circleradius = int(input("What is the radius of the circle?: "))
- circlearea = str(round(math.pi*circleradius** 2))
- print("The area of the circle is", circlearea)
- def Prism():
- prismlength = int(input("What is the length of the rectangular prism?: "))
- prismwidth = int(input("What is the width of the rectangular prism?: "))
- prismheight = int(input("What is the height of the rectangular prism?: "))
- prismvolume = str(round(prismwidth*prismheight*prismlength))
- print("The volume of the rectangular prism is", prismvolume)
- def Cylinder():
- cylradius = int(input("What is the radius of the cylinder?: "))
- cylheight = int(input("What is the height of the cylinder?: "))
- cylsurfacearea = str(round(2*math.pi*cylradius*cylheight+2*math.pi*cylradius**2))
- print("The surface area of the cylinder is", cylsurfacearea)
- def Menu():
- print("1. Find the area of a square\n2. Find the area of a rectangle\n3. Find the area of a circle\n4. Find the volume of a rectangular prism\n5. Find the surface area of a cylinder\n6. Return to the Previous Menu")
- lastmenu = int(input("What would you like to do? Type in the number next to the menu option: "))
- if lastmenu == 1:
- Square()
- if lastmenu == 2:
- Rectangle()
- if lastmenu == 3:
- Circle()
- if lastmenu == 4:
- Prism()
- if lastmenu == 5:
- Cylinder()
- else:
- Main()
- def Main():
- print("1. Use the Handy Toolkit\n2. View Instructions\n3. Exit Program")
- firstmenu = int(input("What would you like to do? Type in the number next to the menu option: "))
- if firstmenu == 1:
- Menu()
- if firstmenu == 2:
- print("You must only enter the numbers 1 to 6 and don't include units")
- Main()
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement