What will be the output of the following Python code?
def f1(a,b=[]):
b.append(a)
return b
print(f1(2,[3,4]))
In the code shown above, the integer 2 is appended to the list [3,4]. Hence the output of the code is [3,4,2]. Both the variables a and b are local variables.
Correct Answer:
[3,4,2]
need an explanation for this answer? contact us directly to get an explanation for this answer