Variables in a loop, Newby question

Joel Goldstick joel.goldstick at gmail.com
Tue Dec 24 11:20:46 EST 2013


On Tue, Dec 24, 2013 at 11:07 AM, <vanommen.robert at gmail.com> wrote:

> Hello, for the first time I'm trying te create a little Python program.
> (on a raspberri Pi)
>
> I don't understand the handling of variables in a loop with Python.
>
>
> Lets say i want something like this.
>
> x = 1
> while x <> 10
>         var x = x
>         x = x + 1
>
> The results must be:
>
> var1 = 1
> var2 = 2
>
> enz. until var9 = 9
>
> How do i program this in python?
> --
> https://mail.python.org/mailman/listinfo/python-list
>

You might want to go to python.org and check out the documentation.  I
don't really understand what you are trying to do.  The var1, var2 stuff
doesn't make sense

In python you can loop like this:

for x in range(10):
  print x

This will print the numbers from 0 to 9.

But your best bet is to find a brief tutorial to get started.



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131224/281598d3/attachment.html>


More information about the Python-list mailing list