Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Hi, I am Martin your personal Bot.")
- command = input("What would you like to do - add, subtract, multiply, divide or the average? ")
- if command == "plus" or command == "add":
- print("Let's add some numbers")
- input1 = input("Input number 1 ")
- input2 = input("Input number 2 ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- output = str(result)
- print(input1 + "+" + input2 + "=" + output)
- elif command == "subtract":
- print("Let's subtract some numbers")
- input1 = input("Input number 1 ")
- input2 = input("Input number 2 ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + "-" + input2 + "=" + output)
- elif command == "multiply":
- print("Let's multiply some numbers")
- input1 = input("Input number 1 ")
- input2 = input("Input number 2 ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + "x" + input2 + "=" + output)
- elif command == "divide":
- print("Let's divide some numbers")
- input1 = input("Input number 1 ")
- input2 = input("Input number 2 ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1/number2
- output = str(result)
- print(input1 + "รท" + input2 + "=" + output)
- elif command == "average" or command == "the average":
- how_many = input("How many numbers? ")
- 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)
- output = total/how_many
- print("The average = " + str(output))
- else:
- print("sorry I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement