Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am R4D4, your personal math bot")
- command = input("How may I help you: add, subtract or average? ")
- if command == "add" or command == "plus":
- print("Let's add some numbers")
- number1 = int(input("number 1: "))
- number2 = int(input("number 2: "))
- result = number1 + number2
- print("Results:", number1, "+" ,number2, "=", result)
- elif command == "subtract" or command == "minus":
- print("Let's substract some numbers")
- number1 = int(input("number 1: "))
- number2 = int(input("number 2: "))
- result = number1 - number2
- print("Results:", number1, "minus", number2, "=", result)
- elif command == "average":
- how_many = input("How many numbers do you wan to average? ")
- how_many = int(how_many)
- total = 0
- for number_count in range(how_many):
- number = input("Enter number " + str(number_count) + " = ")
- total = total + int(number)
- result = total / how_many
- print("average is = " + str(result))
- else:
- print("Sorry, this is the add or subtract or average math bot")
Advertisement
Add Comment
Please, Sign In to add comment