Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation():
- print("lets " + command + " some numbers")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- if command == "add" :
- result = number1 + number2
- k = "+"
- elif command == "subtract" :
- result = number1 - number2
- k ="-"
- output = str(result)
- print(input1 + k + input2 + " = " + output)
- finished = False
- while finished == False :
- print("Hi, I am Marvin, your personal bot.")
- command = input("How can I help? ")
- if command == "add":
- do_calculation()
- elif command == "subtract":
- do_calculation()
- elif command == "bye" :
- finished = True
- else :
- print ("Sorry I do not understand this " )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement