08 Prepare: Checkpoint
Overview
Demonstrate your understand of for
loops.
Assignment
Write a Python Program that does each of the following:
Given the following list of items (copy and paste this line into your program):
colors = ["red", "blue", "green", "yellow"]
Use a
for
loop to iterate through this list one by one and display each item on its own line as follows:red blue green yellow
Use a
for
loop to display the numbers 1–8, one number on each line as follows:Use a
for
loop to display the even numbers (hint: count by two) 2–20, one number on each line as follows:Sample solution: check08_sample.py
Verify that the colors display as desired.
Verify that your output for part 2 does not include 0.
Verify that your output for part 2 does not include 9.
Verify that your output for part 3 does not include any odd numbers.
Verify that your output for part 3 starts at 2 and ends at 20.
1
2
3
4
5
6
7
8
2
4
6
8
10
12
14
16
18
20
Sample Solution
When your program is finished, please view a sample solution of this program to compare your approach to that one.
You should work to complete this checkpoint program first, without looking at the sample solution. However, if you have worked on it for at least an hour and are still having problems, you may feel free to use the sample solution to help you finish your program.
Testing Procedure
Verify that your program works correctly by following each step in this testing procedure:
Submission
When complete, please report your progress in the associated I-Learn quiz.