10-18-2009, 03:19 AM
You can also use a loop function.
While
This one will keep adding 1 to x, until x*x = 4.
For
This will assign every value in a to x and print x.
While
Code:
x = 1
y = 4
while x*x != y:
x +=1
This one will keep adding 1 to x, until x*x = 4.
For
Code:
a = [1,2,3,4,5,6,7,8,9]
for x in a:
print x
This will assign every value in a to x and print x.