git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]# The sum of ten numbers inserted from the user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ian Clark <ianhclark510 at gmail.com> writes: > This is my whack at it, I can't wait to hear about it being the wrong big o > notation! > > numbers=[] > > while len(numbers) < 10: > try: > chip = int(input('please enter an integer: ')) > except ValueError: > print('that is not a number, try again') > else: > numbers.append(chip) > > print(sum(numbers)) Why would you not keep a running total, rather than list of the numbers? I've not been following assiduously, so maybe I missed some other requirement... <snip> -- Ben.

- Prev by Date:
**The sum of ten numbers inserted from the user** - Next by Date:
**The sum of ten numbers inserted from the user** - Previous by thread:
**The sum of ten numbers inserted from the user** - Next by thread:
**The sum of ten numbers inserted from the user** - Index(es):