Python: for, while, Loops
# python 3 # creates a list, 1 to 3 aa = range(1, 4) for xx in aa: print(xx)
range(n)→ return a list from 0 to n, not including n
range(a,b)→ return a list from a to b, not including b
range(a,b,step)→ return a list from a to b, not including b, in steps of step
# python 3 x = 1 while x <= 5: print(x) x += 1
continue to exit loop.
break→ exit the loop.
continue→ skip rest of loop code and start the next iteration.
# python 3 for x in range(1, 10): print(x) if x == 4: break # prints 1 to 4
If you have a question, put $5 at patreon and message me.