Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count = 0
- total = 0
- average = 0
- while True:
- user_input = input("Enter a number: ")
- count += 1
- average = total / count
- try:
- total += float(user_input)
- except ValueError:
- count -= 1
- print("Input needs to be a number.")
- pass
- if user_input == "":
- break
- print("You entered: {} numbers".format(count))
- print("Your numbers total to: {}".format(total))
- print("The average of your numbers is: {}".format(average))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement