I know this is a simple question, but I would like to know why it is printing None
. It just prints None when coding it directly from my terminal. If I write the same code in a file or in a online Python compiler and then run it, I don't get the same output.
Coding directly from my terminal:
>>> b = [(1, 2), (3, 4), (5, 6)]
>>> [print(a) for a in b]
(1, 2)
(3, 4)
(5, 6)
[None, None, None]
Running in a Python Online Compiler:
Running Python file:
I know it is not the same array, but it is the same logic.
b = ([100.64188563286582, 101.64188563286582], [-1.0626228, -0.8626228], [-5.0, -15.0], [-float('inf'), float('inf')], [float('inf'), float('inf')], [-float('inf'), float('inf')], [-float('inf'), float('inf')])
[print(a) for a in b]