Generators vs lists

Report a typo

Let numbers be a list of natural numbers. Consider the two ways of defining odd:

A.

odd = (n for n in numbers if n % 2 == 1)

B.

odd = [n for n in numbers if n % 2 == 1]

In which case odd is a generator and in which it's a list?

Select one option from the list
___

Create a free account to access the full topic