Simple question about print function (python 3.9.13) what causes these (a link to some informative page will be appreciated). I have a list of strings and I want to print them each on separate line in an interactive session.
>>> aa = ['word 1','test 2', 'blah 3', 'ding 4']
>>> [print(x) for x in aa]
word 1
test 2
blah 3
ding 4
[None, None, None, None]
>>> (print(x) for x in aa)
<generator object <genexpr> at 0x000001D8AC975DD0>
>>> print(x) for x in aa
SyntaxError: invalid syntax
>>> {print(x) for x in aa}
word 1
test 2
blah 3
ding 4
{None}
>>>
Question: could you explain these behaviours, especially what causes those None to appear and how to avoid it?