On 5/21/2019 9:11 PM, CrazyVideoGamez wrote:
I tried doing a list comprehension. I typed:
favorite_fruits = ['watermelon', 'blackberries']
print(fruit for fruit in favorite_fruits)
And I got:
<generator object <genexpr> at 0x0402C7B0>
What does this mean
It means that the expression (fruit for fruit in favorite_fruits)
evaluates to a generator object.
and what do I have to fix?
Perhaps you wanted to run the generator, perhaps like this:
>>> favorite_fruits = ['watermelon', 'blackberries']
>>> print(*(fruit for fruit in favorite_fruits))
watermelon blackberries
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list