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
- 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 Khamisi, 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 don't understand this")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement