Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def do_calculation():
- print("Let's " + command + " some numbers: ")
- input1 = input("Number 1> ")
- input2 = input("Number 2> ")
- number1 = int(input1)
- number2 = int(input2)
- if command == "add":
- result = number1 + number2
- operator = " + "
- elif command == "subtract":
- result = number1 - number2
- operator = " - "
- output = str(result)
- print(input1 + operator + input2 + " = " + output)
- finished = False
- while finished == False:
- print("Hi, I am Eley, your personal bot.")
- command = input("If you want to calculate some numbers write 'add' or 'subtract': ")
- if command == "add":
- do_calculation()
- elif command == "subtract":
- do_calculation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement