Run the program Alpha-py-3-eggs.py in your shell. It should look similar to:
Look at the program - open Alpha-py-3-eggs.py in your text editor.
Notice how the different types of loops work:
for b in 1,3,4,5,7:
some_values = [3,6,7,10,11,13] for b in some_values:
for b in range(7):
b = 2
while b < 14:
...
b = b + 3
The "for loop" is used when you know in advance how many times you want to do the loop. You want to do the same thing for a whole lot of different values.
The "while loop" is used when you don't know in advance how many times you want to do the loop. You want to do the same thing while the condition (in our case, b < 14) is true.
Open Alpha-py-3-spam.py in your text editor.
Try making some changes in the text editor. How about:
Now save your changes, and run the changed program in your shell.
Open Alpha-py-2-ham.py (that you worked on in chapter 2) in your text editor.
Make multiples of your picture too. Save it with a new name, such as Alpha-py-3-ham.py