Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I'm Marvin, your personal bot.")
- command = input("How can I help? ")
- #user specifies what they would like bot to do.
- #user asks bot to add
- if command == "add" or command == "plus" or command == "+":
- print("lets " +command +" some numbers")
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1=int(input1)
- number2=int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + " + " + input2 + " = " +output)
- #user asks bot to subtract
- elif command == "subtract" or command == "take away" or command == "takeaway" or command == "minus":
- print("lets "+command+" some numbers")
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1=int(input1)
- number2=int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " - " + input2 + " = " +output)
- #user asks bot to multiply
- elif command == "multiply" or command == "times":
- print("lets " +command+ " some numbers")
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1=int(input1)
- number2=int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + " * " + input2 + " = " +output)
- #user asks bot to divide
- elif command == "divide":
- print("lets " +command+ " some numbers")
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1=int(input1)
- number2=int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + " / " + input2 + " = " +output)
- else:
- print(" Sorry I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement