On Sat, 03 Oct 2015 10:40:57 -0700, Ronald Cosentino wrote:

> def funA(x,y,z):
>     return (x+y) * z
> def funB(x,y):
>     return(x-y)
> print(funA(4,funB(2,3), funB(3,2)))
> 
> the answer is 3. I don't know how it works.

def funA(x, y, z):
    return (x+y) * z

def funB(x, y):
    return (x-y)

# this line
# print(funA(4,funB(2,3), funB(3,2)))
# can be written as the following 4 lines:

a = funB(2, 3) # 2 - 3 -> -1

b = funB(3, 2) # 3 - 2 -> 1

c = funA(4, a, b) # (4 + -1) * 1 -> 3

print(c) # 3

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to