Python Typing Practice

Python uses punctuation to express structure. In this line, the brackets build a new list and the underscore joins two words in a variable name.

squared_values = [n ** 2 for n in range(4)]

Follow the expression

The loop visits zero, one, two, and three. The two asterisks raise each value to a power, so the list becomes zero, one, four, nine. Leaving out one asterisk changes the operation to multiplication. Type the line again and pay attention to that pair.

Practice tracing a Python loop →

JavaScript typing practice · Typing practice for programmers · Colemak typing practice