Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # add the math library module
- import math
- print("Hi, I am Rosie, your personal bot.")
- print("How can I help?")
- command = input("Type add, subtract, multiply, divide, or type area to find the area of a circle.")
- if command == "add":
- print("Let\'s add some numbers.")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + " plus " + input2 + " = " + output)
- elif command == "subtract":
- print("Let\'s subtract some numbers.")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " minus " + input2 + " = " + output)
- elif command == "multiply":
- print("Let\'s multiply some numbers.")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + " times " + input2 + " = " + output)
- elif command == "divide":
- print("Let\'s divide some numbers.")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + " divided by " + input2 + " = " + output)
- elif command == "area":
- print("Let\'s find the area of a circle.")
- print("The area of a circle is pi times its radius squared.")
- input1 = input("Radius > ")
- number1 = float(input1)
- result = math.pi * number1 * number1
- output = str(result)
- print("The area of the circle = " + output)
- else:
- print("Sorry, I don't understand.")
- print("Thanks. Try another!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement