Advertisement
Roddyn

bot_add_subtract

Dec 9th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. print("Hi, I am Marvin, your personal bot.")
  2. user_name = input ("What is your name? ")
  3. print("Welcome " + user_name )
  4. command = input("How can I help? ")
  5. if command == "add":
  6. print("let's add some numbers")
  7. input1 = input("Number 1> ")
  8. input2 = input("Number 2> ")
  9. number1 = int(input1)
  10. number2 = int(input2)
  11. result = number1 + number2
  12. output = str(result)
  13. print(input1 + " + " + input2 + " = " + output)
  14. elif command == "subtract":
  15. print("let's subtract some numbers")
  16. input1 = input("Number 1> ")
  17. input2 = input("Number 2> ")
  18. number1 = int(input1)
  19. number2 = int(input2)
  20. result = number1 - number2
  21. output = str(result)
  22. print(input1 + " - " + input2 + " = " + output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement