after printing the array in a for loop I also get an additional array of None for seemingly no reason
When running from file
A= [1,2,3,4,5]
[print(i) for i in A]
prints
1
2
3
4
5
as expected.
However with Jupyter I also get an array on None of equal length to the original array like:
#%%
A= [1,2,3,4,5]
[print(i) for i in A]
1
2
3
4
5
6
7
[None, None, None, None, None, None, None]
the array disappears if i print something after printing the array for example:
#%%
A= [1,2,3,4,5]
[print(i) for i in A]
print("test")
returns
1
2
3
4
5
6
7
test
Why does that happen?
I’m using vscode, python 3.11.19 and Jupyter extension pack by Microsoft
New contributor
Krzyp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.