List and dict comprehensions · exercise 1 of 1 · free preview
The game so far · chapter 17
Right now: Nobody knows where the dangerous readings in the log are.
This chapter's mission: Finds the Data Mine hot spots. Work through the exercises, then your own code brings it to life.
A list comprehension builds a list in one line: [n * n for n in range(5)]. Read it as: n times n, for each n in the range.
Print the list of squares of the numbers 0 to 4, using a list comprehension.