Advertisement
MartC

bot

Apr 5th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. print("Hi, I am Marvin, your personal bot.")
  2. print("I hope you are feeling well today.")
  3. print("OK, let's get started...")
  4. users_name = input ("What's your name? ")
  5. print("Welcome " + users_name + "!")
  6. command = input("What can I do for you? >")
  7. if command == "add" or command == "plus" or command == "+":
  8.     print("Let's add some numbers!")
  9.     input1 = input("Number 1 > ")
  10.     input2 = input("Number 2 > ")
  11.     number1 = int(input1)
  12.     number2 = int(input2)
  13.     result = number1 + number2
  14.     output = str(result)
  15.     print(input1 + " + " + input2 + " = " + output)
  16. elif command == "subtract" or command == "take away" or command == "-":
  17.     print("Let's subtract some numbers!")
  18.     input1 = input("Number 1 > ")
  19.     input2 = input("Number 2 > ")
  20.     number1 = int(input1)
  21.     number2 = int(input2)
  22.     result = number1 - number2
  23.     output = str(result)
  24.     print(input1 + " - " + input2 + " = " + output)
  25. else:
  26.     print("I'm sorry, I don't understand...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement