Question d’entretien chez Squarepoint Capital

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

Réponse à la question d'entretien

Utilisateur anonyme

26 déc. 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