Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- print("Hi, my am marvin, your personal bot.")
- users_name = input("What is your name? ")
- print("Welcome "+ users_name)
- #print("Let's add or subtract some numbers")
- input1 = float(input("Enter number 1> "))
- input2 = float(input("Enter number 2> "))
- # add or subtract??
- anser = input("Do you want to add, subtract, multiply, divide or average ?")
- if anser == "add":
- result = input1 + input2
- print(input1, "+", input2, "=", result)
- elif anser == "subtract":
- result = input1 - input2
- print(input1, "-", input2, "=", result)
- elif anser == "multiply":
- result = input1 * input2
- print(input1, "*", input2, "=", result)
- elif anser == "divide":
- result = input1 / input2
- print(input1, "/", input2, "=", result)
- elif anser == "average":
- how_many = int(input("How many more numbers?"))
- total = input1 + input2
- # enter the additional numbers
- for number_count in range(how_many):
- number = int(input("Enter number " + str(number_count + 3)+ "> "))
- total = total + number
- # average all the numbers
- result = total/(how_many+ 2)
- print("The average of the", str(how_many+ 2),"numbers is", str(result))
- else:
- print("I don't understand")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement