[Tutor] Return problems
Alan Gauld
alan.gauld at yahoo.co.uk
Sat Apr 7 03:58:38 EDT 2018
On 07/04/18 01:50, Roger Lea Scherer wrote:
> So I've examined my educational material, I've perused the python
> documentation and for the life of me I can't figure out why return doesn't
> print a result in the IDE. I use print, the program acts as expected. What
> am I missing?
The fact that return doesn't print anything it just returns
a value to the caller.
I suspect that you are getting confused by the behaviour of
the interactive prompt (>>>) which automatically prints
results. But that is purely a feature of the >>> prompt
designed to make developing/debugging code easier.
In regular Python code execution values are only printed
when you ask for them to be by using print. And if you
think about it, that's a good thing, otherwise the screen
would quickly fill with a mess of intermediate values
the user doesn't need.
--
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