I m trying to learn to code in a "pythonic way".
The original code is working, results and displays the expected results. The new code is giving: "<generator object at 0x0000017862039510>". Why then ?
Original code:
a={
'AA':-5,
'BB':-8,
'C':15,
'D':-85,
'E':24
}
for i in a.values():
if i<0:
print(i)
New code :
a={
'AA':-5,
'BB':-8,
'C':15,
'D':-85,
'E':24
}
print(i for i in a.values() if i<0 )
Thank you !