Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am R2D2, your personal math bot")
- command = input("You may direct me to calculate the area of a circle or triangle: ")
- if command == "triangle":
- print("Please enter the base and height when requested")
- base = int(input("base of triangle: "))
- height = int(input("height of triangle: "))
- tri_area = 0.5 * base * height
- print("Area of triangle with base =", base, "&" ,"height =",height,"is", tri_area)
- elif command == "circle":
- print("Please enter the diameter of the circle: ")
- diameter = int(input("diameter of circle: "))
- cir_area = 3.14 * (0.5 * diameter)**2
- print("Area of circle with diameter =",diameter, "is", cir_area)
- else:
- print("Sorry, this is the area math bot for a triangle or circle")
Add Comment
Please, Sign In to add comment