function code snippet that has function calls I have never seen before. How does it work.

Joel Goldstick joel.goldstick at gmail.com
Sat Oct 3 14:01:21 EDT 2015


On Sat, Oct 3, 2015 at 1:40 PM, Ronald Cosentino <ronjc.2001 at gmail.com>
wrote:

> def funA(x,y,z):
>     return (x+y) * z
>
The above takes 3 values and returns a value


> def funB(x,y):
>     return(x-y)
>
The above takes 2 values and returns a value


> print(funA(4,funB(2,3), funB(3,2)))
>

you are printing the result of funA, to which you are passing 4, the value
returned by funB(2,3) and the value returned by funB(3,2)

So, print(funA(4, -1, 1))

Which is 4 + -1 * 1

Which is 3 * 1


>
> the answer is 3. I don't know how it works.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151003/b4968ee3/attachment.html>


More information about the Python-list mailing list