Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation():
- print("lets " + command + " some numbers")
- input1 = input("Number1>")
- input2 = input("Number2>")
- number1 = int(input1)
- number2 = int(input2)
- if command == "add":
- result = number1 + number2
- elif command == "subtract":
- result = number1 - number2
- elif command == "divide":
- result = number1 / number2
- elif command == "multiply":
- result = number1 * number2
- elif command == "averaging":
- result = number1 + number2 / 2
- output = str(result)
- if command == "add":
- print(input1 + "+" + input2 + "=" + output)
- elif command == "subtract":
- print(input1 + "-" + input2 + "=" + output)
- elif command == "divide":
- print(input1 + "/" + input2 + "=" + output)
- elif command == "multiply":
- print(input1 + "*" + input2 + "=" + output)
- elif command == "averaging":
- print (input1 + "+" + input2 + "/2" + 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 == "divide":
- do_calculation()
- elif command == "multiply":
- do_calculation()
- elif command == "averaging":
- do_calculation()
- elif command == "bye":
- finished == True
- break
- else:
- print("Sorry I can't help you with that")
Add Comment
Please, Sign In to add comment