On Thu, Feb 7, 2019 at 6:31 AM ^Bart <gabriele1nos...@hotmail.com> wrote:
>
> I thought something like it but doesn't work...
>
> for n in range(1, 11):
>      x = input("Insert a number: ")

The above, keeps replacing x with each input value.  You don't want
that.  Think about appending the input value to a list
>
> for y in range(x):
>      sum = y
>
Here again you are replacing sum with each value of y.  And think
further about what the value of y is for each iteration.

>      print ("The sum is: ",y)

You should really be asking this sort of question in the python-tutor
mailing list.  You should also use print function in your loops to
learn what is really going on.



> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to