Learn
Loops
Review

Good job! In this lesson, you learned

• how to write a for loop
• how to use `range` in a loop
• what infinite loops are and how to avoid them
• how to skip values in a loop
• how to write a while loop
• how to make lists with one line

Let’s get some more practice with these concepts!

### Instructions

1.

Create a list called `single_digits` that consists of the numbers 0-9 (inclusive).

2.

Create a for loop that goes through `single_digits` and prints out each one.

3.

Before the loop, create a list called `squares`. Assign it to be an empty list to begin with.

4.

Inside the loop that iterates through `single_digits`, append the squared value of each element of `single_digits` to the list `squares`. You can do this before or after printing the element.

5.

After the for loop, print out `squares`.

6.

Create the list `cubes` using a list comprehension on the `single_digits` list. Each element of `cubes` should be an element of `single_digits` taken to the third power.

7.

Print `cubes`.

Good job!