Q16Section DA (Data Science and Artificial Intelligence (Q11–Q65))16 of 65
Output of a function with a mutable default list argument
Consider the given Python program.
def append_to_lst(val, lst=[]):
lst.append(val)
return lst
print(append_to_lst(1))
print(append_to_lst(2))
print(append_to_lst(3, []))
Which of the following is the correct output of this program?
Pick an option to check your answer. In a mock test a wrong answer here costs 1/3 mark.