Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am Marvin, your personal bot.")
- print("Do you want to add or substract ?")
- command = input("How can I help ?")
- if command == "add" or command == "plus":
- print("Let's add 3 numbers.")
- input1 = input("Number 1> ") # input numbers are strings#
- input2 = input("Number 2> ")
- input3 = input("Number 3> ")
- number1 = int(input1) # use int to convert string to integer#
- number2 = int(input2)
- number3 = int(input3)
- result = number1 + number2 + number3 #by using add #
- output = str(result) #result of operation#
- print(input1 + " + " + input2 + " + " + input3 + " = " + output)
- elif command == "substract":
- print(" Let's substract 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