I am trying to use lambda for a usecase, but it seems not working. The following is what I tried
The below is what I used, in stackflow I came across many people getting output for this, but for me its None
from __future__ import print_function
f = lambda x: print(x)
f()
f("Hello") ### now out put is shown expected is Hello output
f("Hello") is None ## I checked if its None and it is
>>> True
l = lambda x : sys.stdout.write(x)
l('hello') # this time its showing output as 5 instead of printing hello
>>> 5
I even tried something which is not using lambda, unfourtunately that too not working, and got None
from functools import partial
spam = partial(print, 'Hello!')
spam()
spam() is None
>>> True
I got this from the last answer in this question assigning print function to variable
Can anyone help me what I am missing and why I am not able to print the string?


print("Hello"), does it appear correctly?f()call raisesTypeErrorfor me both locally and on jupyter.org/try. Then the rest of the lines does not run, but the error message is pretty visible by default. Have you tried restarting the kernel? Based on your screenshot, you are at the 59-60th input, and who knows happened earlier.