On 12/24/2013 11:07 AM, vanommen.rob...@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?
The larger question is "why do you want to do that". It can be done but it is almost always a bad idea. Tell us what your goal is and we can tell you how we'd go about it.

BTW when checking a condition in a while statement it is better practice to say while x < 10. In the above case it does not matter but if you were incrementing x by 2 your code would be in an infinite loop, mine would still stop.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to