Advertisement
LHerr

hashtag comment

Feb 19th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 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. #asking user to input whether to add or subtract
  4. if command == "add" or command == "plus":
  5. #use the or if there are varying correct answers
  6. print ("Wonderful. I will need the numbers you would like to add.")
  7. input1 = input("Number 1>")
  8. input2 = input("Number 2>")
  9. number1 = int(input1)
  10. #used to change a string to an integer for calculations
  11. number2 = int(input2)
  12. result = number1 + number2
  13. output = str(result)
  14. print (input1 + "+" + input2 + "=" + output)
  15. elif command == "subtract" or command == "minus":
  16. print ("Wonderful. I will need the numbers you would like to subtract")
  17. input1 = input("Number 1>")
  18. input2 = input("Number 2>")
  19. number1 = int(input1)
  20. number2 = int(input2)
  21. result = number1 - number2
  22. output = str(result)
  23. print (input1 + "-" + input2 + "=" + output)
  24. else:
  25. print ("I am sorry I did not understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement