python-crash-course/Chapter_04/4-9_cubeComprehension.py
2025-01-21 12:57:22 -05:00

7 lines
227 B
Python

# Exercise 4-9 Cube Comprehension
# Learning Objective: Use List Comprehension to create list of first 10 cubes.
cubes = [value**3 for value in range(1, 11)]
print(cubes)
# Unbenownst to me, I had done that already in 4-8.