Python Loops

Let’s give a few looks, to see the pythoness of it all. Otherwise, the loops in python are pretty much the same at a core level as any number of other programming languages. I will assume you recognize their purpose and show them for syntax only.

#set start value 
i = 3
Determine end of loop value,  
notice : and indentation like the "if" and "case" statements learned before
while i <= 0:
     la la la
     i = i - 1
     i =+ 1   is another option to add 1 to i if that was your want

Notice the [ ] hard brackets for lists
for i in [1,2,3]:
    la la la
of course you might want to use a list more for not numerics
for fruit in [apple,ban,pear]
    la la x = i la la
of course, if you want numerics or a count
for _ in range(3)
    la la la la
does 0,1,2 but the _ is a not visible variable, meaning you  can not use it like i
but the for logic is using it to help it loop 3 times with a 0 1 2.

break from infinite loop, force an infinite loop until get what you want.
continue mean continue to loop,  I know in English it can be used in a sentence to continue onwards but it means here go to start of loop again;   break here is break out of loop,  break out of jail,  not take a break or go to sleep or like the more complex break point to pause long programs.

while True:
     n = int(input(please give me positive))
     if not_a_number():                   not a real function, to demonstrate continue
          continue
     if n > 0:
      break
using len for length of list, or number of objects in a_list.
for i in range(len(a_list))
      la la   x = i la la