Note: Return and Print

I was learning Return statement.

The example is below:

def maximum(x,y):

if x > y:

return x

elif x == y

return ‘The numbers are equal’

else:

return y

 

print maximum(2,3)

————

The output is:

3

I was wondering if there’s any difference between return and print. So I modified a little. I replaced return with print.

The out put turned out to be:

3

None.

What happened? Je sais pas.

Then I continued reading. I saw a “return None” and i realized that there must be something to do with the None above.

But I have no clue.

Leave a Reply

Your email address will not be published. Required fields are marked *