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

The sum of ten numbers inserted from the user

Am 08.02.19 um 09:58 schrieb ^Bart:
> A colleague did:
> total=0
> for n in range(10):
>  ??? n= int(input("Enter a number: "))

Here, you are reusing "n" for two different things:
1. The loop index, indicating which number you ask for
2. The number entered from the user

This is avery bad thing.