15. Quiz: Match Inputs To Outputs
Test Your Loop Knowledge
In case you want to test any code for the quizzes that follow, there is a code editor at the bottom of this page where you can experiment.
QUIZ QUESTION: :
Practice with range
For each below, match the input code to the appropriate output.
ANSWER CHOICES:
Input |
Output |
---|---|
[4,6,8,10] |
|
Error |
|
[4,5,6,7] |
|
[0,1,2,3] |
|
[ ] |
|
[1,2,3,4] |
|
[0,1,2,3,4] |
|
[1,2,3] |
|
[4,6,8] |
|
[4,5,6,7,8] |
SOLUTION:
Input |
Output |
---|---|
[4,5,6,7] |
|
[0,1,2,3] |
|
[ ] |
|
[4,6,8] |
Use the code below to complete the next quiz.
colors = ['Red', 'Blue', 'Green', 'Purple']
lower_colors = [ ]
for color in colors:
#finish this part
SOLUTION:
lower_colors.append(color.lower())Start Quiz:
# Use the space here to practice whatever you would like pertaining to
# the above quizzes.