Imagine you are riding a merry-go-round and there is a pile of rocks by the side. Each time you go around, you want to pick up one rock and put it into a box. Another way to thing about it is steps along a path. Each indented line is a step along the path, and each step means that the line has been run.
The "while True" means "keep run the following indented lines".
The 'break' is a special word that means "skip the indented lines and quit running the loop"
boxA = 0 # At first there aren't any rocks in the box.
while True: # Loop in the merry-go-round
boxA = boxA + 1 # Once we get to the pile, add one rock to the box
print(boxA) # Show the number of rocks in the box.
if boxA > 3: # Are there more than 3 rocks?
print('quit loop now')
break
print('done')
1 2 3 4 quit loop now done
The steps every time through the loop look like this.
boxA = 0 # At first there aren't any rocks in the box.
while boxA < 3: # Loop in the merry-go-round
boxA = boxA + 1 # Once we get to the pile, add one rock to the box
print(boxA) # Show the number of rocks in the box.
1 2 3
for boxA in range(0, 3):
print(boxA)
0 1 2
There is also a way to get a value from a list each time through the loop.
# For Lists
colors = ['red', 'blue', 'green']
for boxA in colors:
print(boxA)
red blue green