Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I want this program to help with simple calculations
- print ("Hi, I am Marvin, your personal bot")
- command = input ("How can I help?")
- # I might need to give the user more of a clue to the response
- # needed from them but will expect them to know for now
- # the first option is addition
- if command == "add":
- print ("lets add some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + " + " + input2 + " = " + output)
- # the next option is subtraction
- elif command == "subtract":
- print ("lets subtract some numbers")
- input1 = input ("Number1>")
- input2 = input ("Number2>")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " - " + input2 + " = " + output)
- # or if the user input doesn't match then tell them
- else:
- print ("I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement