Consider the given Python program.
Which of the following is the correct output of this program?
python
- Acode
- Bcode
- Ccode
- Dcode
Programming, Data Structures and AlgorithmsProgramming in PythonMCQ1 mark · −1/3 if wrongMedium
1def append_to_lst(val, lst=[]):
2 lst.append(val)
3 return lst
4print(append_to_lst(1))
5print(append_to_lst(2))
6print(append_to_lst(3, []))
71[1]
2[2]
3[3]
41[1]
2[1, 2]
3[3]
41[1]
2[2]
3[1, 2, 3]
41[1]
2[1, 2]
3[1, 3]
4A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.