Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hi, my name is Lisa, our personal bot.")
- command = input("How can I help? Would you like to add or subtract?")
- #asking user to input whether to add or subtract
- if command == "add" or command == "plus":
- #use the or if there are varying correct answers
- print ("Wonderful. I will need the numbers you would like to add.")
- input1 = input("Number 1>")
- input2 = input("Number 2>")
- number1 = int(input1)
- #used to change a string to an integer for calculations
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print (input1 + "+" + input2 + "=" + output)
- elif command == "subtract" or command == "minus":
- print ("Wonderful. I will need the numbers you would like to subtract")
- 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 ("I am sorry I did not understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement