I have been learning Python for some days now. However, I do not understand return. I have read several explanations from my textbooks and online; they don\'t help!
The return keyword is to exit a function and return a value. To let a function return a value, use the return statement.
As Charlie Duffy comments, when you don't use return anywhere in your function, Python has an implicit return value of None. In other words, if you don't tell a function it should return something, then None is what it returns.
So if you change
def gimmieFive(): return 5to justdef gimmieFive(): 5, then someone who runsx = gimmieFive()will havex == None, instead ofx == 5. The 5 just gets thrown away when gimmieFive exits.