What is the output of the following? “`python gen = (x for x in range(10) if x % 3 == 0) result = list(gen) print(result) print(list(gen)) “`
Key points
- Generator expressions are consumed once used
- List comprehension creates a new list
- The second print statement returns an empty list
Ready to go further?
