Op dinsdag 24 december 2013 17:23:43 UTC+1 schreef Jean-Michel Pichavant:
> ----- Original Message -----
> > 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?
> 
> Short story, cause it's almost xmas eve :D:
> 
> python 2.5:
> 
> var = {}
> for i in range(10):
>   var[i] = i
> 
> print var[1]
> print var[2]
> print var
> 
> var here is a dictionary. I suggest that you read through the python tutorial 
> :)
> 
> JM
> 
> 
> -- IMPORTANT NOTICE: 
> 
> The contents of this email and any attachments are confidential and may also 
> be privileged. If you are not the intended recipient, please notify the 
> sender immediately and do not disclose the contents to any other person, use 
> it for any purpose, or store or copy the information in any medium. Thank you.

This was the information I was looking for and what my first question was 
about. Got this working, Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to