Consider the given Python program.
Which of the following options is/are correct?
python
- Af1 and f2 share the same list x
- BOutput of Line Q is [10, 20]
- COutput of Line R is [10, 20, 30]
- DOutput of Line S is [10, 20, 40]
Programming, Data Structures and AlgorithmsProgramming in PythonMSQ2 marksMedium
1def outer():
2 x = []
3 def inner(val):
4 x.append(val)
5 return x
6 return inner
7f1 = outer()
8f2 = outer()
9print(f1(10)) # Line P
10print(f1(20)) # Line Q
11print(f2(30)) # Line R
12print(f1(40)) # Line S
13A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.