Sollicitatievraag bij Squarepoint Capital

In Python, what is the difference between a generator expression and a list comprehension?

Antwoord op sollicitatievraag

Anoniem

26 dec 2016

Example of list comprehension: [x*2 for x in range(10) if x%2] Example of generator expression: (x*2 for x in range(10) if x%2)

2