Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
Create a list of cubes for numbers 1-5 using list comprehension.
Use `x**3` in the expression.
Generate a list of the first 5 letters of the alphabet.
Use the `chr()` and `ord()` functions.
What does the following list comprehension do: squares = [x*x for x in range(1, 6)]?
Consider the effect of multiplying a number by itself.
True or False: List comprehensions can include conditions to filter items.
Recall how filtering is done using conditions.
Using list comprehension, create a list of tuples where the first element is a number from 1 to 5 and the second element is its cube.
Think about how to format each item into a tuple.
Given a list of strings, create a new list with only the strings that have more than 3 characters using list comprehension.
Compare the length of each word to 3.
5 more questions in this section. Enroll free to practise them all.
Enroll free