Python Newbie here!
def x():
print ('y')
x()
This produces the output- 'y'
BUT
def x():
print ('y')
a = x()
print (a)
This produces 'y' and 'None' at the end. Why the none at the end?
Python Newbie here!
def x():
print ('y')
x()
This produces the output- 'y'
BUT
def x():
print ('y')
a = x()
print (a)
This produces 'y' and 'None' at the end. Why the none at the end?
This is because the function x () is returning nothing, hence None.
return 'y' to get print of 'a'.
Hope this helps.