1 1 vote Consider the following Python code:def make_list(): data = [1] try: return data finally: data.append(2) result = make_list() print(result)What is the output of the code above?[1][1, 2]NoneRuntimeError Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-192 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 98 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote Inside the function, $\texttt{data}$ starts as:[1]The $\texttt{try}$ block prepares to return this list.However, before the function actually returns, the $\texttt{finally}$ block must execute.The statement $\texttt{data.append(2)}$ modifies the same list object.So the list becomes:[1, 2]Since the returned object is the same list, the final output is:[1, 2]Correct Option: B GO Classes answered Jun 5 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.