Advertisement
LHerr

add and subtract

Feb 19th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. print ("Hi, my name is Lisa, our personal bot.")
  2. command = input("How can I help? Would you like to add or subtract?")
  3. if command == "add" or command == "plus":
  4. print ("Wonderful. I will need the numbers you would like to add.")
  5. input1 = input("Number 1>")
  6. input2 = input("Number 2>")
  7. number1 = int(input1)
  8. number2 = int(input2)
  9. result = number1 + number2
  10. output = str(result)
  11. print (input1 + "+" + input2 + "=" + output)
  12. elif command == "subtract" or command == "minus":
  13. print ("Wonderful. I will need the numbers you would like to subtract")
  14. input1 = input("Number 1>")
  15. input2 = input("Number 2>")
  16. number1 = int(input1)
  17. number2 = int(input2)
  18. result = number1 - number2
  19. output = str(result)
  20. print (input1 + "-" + input2 + "=" + output)
  21. else:
  22. print ("I am sorry I did not understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement