Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.58 KB | None | 0 0
  1. print("Hi, I'm Marvin, your personal bot.")
  2. command = input("How can I help? ")
  3. #user specifies what they would like bot to do.
  4. #user asks bot to add
  5. if command == "add" or command == "plus" or command == "+":
  6.     print("lets " +command +" 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. #user asks bot to subtract
  15. elif command == "subtract" or command == "take away" or command == "takeaway" or command == "minus":
  16.     print("lets "+command+" some numbers")
  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. #user asks bot to multiply    
  25. elif command == "multiply" or command == "times":
  26.     print("lets " +command+ " some numbers")
  27.     input1=input("Number 1 = ")
  28.     input2=input("Number 2 = ")
  29.     number1=int(input1)
  30.     number2=int(input2)
  31.     result = number1 * number2
  32.     output = str(result)
  33.     print(input1 + " * " + input2 + " = " +output)
  34. #user asks bot to divide    
  35. elif command == "divide":
  36.     print("lets " +command+ " some numbers")
  37.     input1=input("Number 1 = ")
  38.     input2=input("Number 2 = ")
  39.     number1=int(input1)
  40.     number2=int(input2)
  41.     result = number1 / number2
  42.     output = str(result)
  43.     print(input1 + " / " + input2 + " = " +output)
  44. else:
  45.     print(" Sorry I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement