Advertisement
HBSB

Python 101 2.12 Commands

Dec 9th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. print("Hello there.  My name is Marvin and I'm your personal bot.")
  2. user_name=input("What's your name?")
  3. print("Hello " + user_name + " and welcome.")
  4. command = input("How can I help? >")
  5. if command == "add" or command == "plus":
  6.     print("Let's add some numbers.")
  7.     input1=input("Number1 > ")
  8.     input2=input("Number2 > ")
  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" or command == "take away":
  15.         print("Let's subtract some numbers.")
  16.         input1=input("Number1")
  17.         input2=input("Number2")
  18.         number1=int(input1)
  19.         number2=int(input2)
  20.         result=number1-number2
  21.         output=str(result)
  22.         print(input1 + "-" + input2 + "=" + output)
  23. else:
  24.         print("Sorry I don't understand.  Bye.")
  25.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement