On Sun, 4 Oct 2015 04:40 am, 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.
Break it up and consider it a little at a time, starting with the three values given to funA: * calculate 4 (too easy, it's already done) * calculate funB(2, 3) => funB(2, 3) returns 2-3, which gives -1 * calculate funB(3,2) => funB(3, 2) returns 3-2, which gives 1 Then pass those three values to the funA function: * calculate funA(4, -1, 1) => which returns (4 + -1)*1, which gives 3 and finally pass that value to print: * print(3) which prints 3. -- Steven -- https://mail.python.org/mailman/listinfo/python-list