0

Can someone help with the interpretation pls ?

arr= ([ 4 , 1 ] , [ 3 , 6 ] ) fa= lambda x, y = 0 : x+y for n in arr : print(fa(*n))

17th Oct 2020, 3:32 PM
Curious Ant
Curious Ant - avatar
1 Antwort
+ 9
*n is variable number of arguments https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2484/?ref=app lambda is one-line function https://www.sololearn.com/learn/Python/2460/?ref=app The code snippet adds 4 and 1 and then add 3 and 6 for n in arr, so n is [4, 1] and then n is [6, 1] fa(*[4,1]) is same as fa(4, 1) lambda x, y : x +y is same as def fa(x, y) : return x + y so fa(4, 1) is 4 + 1
17th Oct 2020, 3:35 PM
Gordon
Gordon - avatar