[Tutor] Requesting help

dn PythonList at DancesWithMice.info
Sun Apr 3 17:29:02 EDT 2022


On 04/04/2022 04.20, Eleejay 1O1 wrote:
> Hello,
> 
> I'm currently enrolled in the Python Programming course with Google. And
> I'm trying to understand returning values and returning values using
> functions. I do understand the role of functions, however, the use of
> return using functions throws me off. Can you help me with this?


Can this question be made more specific?

"I do understand the role of functions": what do you understand? Perhaps
your understanding is different from Python's!

Particularly when: "the use of return using functions throws me off" -
given that many?most functions exist purely to return a value(s)!


When people of @Dennis and my vintage first started-out in computing, a
popular mantra was "Input, Process, Output".

It may be helpful to regard a function as a "process" - it achieves
something. Please inspect some (good) example code and note that a
function's name involves a verb (back when I was at school: a 'doing'
word), eg

    calculate_wages()
    format_full_name_and_title()
    arrange_draws_for_league()

So, it has an objective, which generalises to 'take some "input", do
something to "process" it, and produce some "output".

For bonus-points: if your function's name includes the word "and", it
should probably be split into two...


How does a function take input-data? Answer: arguments and parameters
(and more besides). The post doesn't mention this 'side'. So, will
ignore for-now.


How does a function deliver its output? This known as "return-ing" its
result(s). How do you understand a function to communicate its completed
task?


How do you understand the input-process-output pattern of functions?
-- 
-- 
Regards,
=dn


More information about the Tutor mailing list