[Tutor] Getting started with Pandas

Alan Gauld alan.gauld at yahoo.co.uk
Wed Aug 22 06:56:44 EDT 2018


On 22/08/18 11:29, Rafael Knuth wrote:

> my code below did not require a return statement, hence I was assuming
> it wouldn't be needed in my function either.

return is only used inside a function, it makes no
sense outside (and is a syntax error). Its purpose
is to return a value to the caller of the function.

Any time you want to get a value back from a function
you must use return (or the slightly more esoteric 'yield')
Otherwise you will receive the default return value of None.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list