1 1 vote Consider the following Python code:def calc(a, b): a, b = b, a + b return a, b, a + b x, y, z = calc(2, 5) print(x, y, z)What is the output of the code above?5 7 122 5 75 2 77 5 12 Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-205 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 102 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes Initially, inside the function:a = 2 b = 5The statement below uses tuple unpacking.a, b = b, a + bThe right side is evaluated first.b = 5 a + b = 2 + 5 = 7So after unpacking:a = 5 b = 7The function returns:a, b, a + b = 5, 7, 12These three returned values are unpacked into $\texttt{x}$, $\texttt{y}$, and $\texttt{z}$.Therefore, the output is:5 7 12Correct Option: A GO Classes answered Jun 20 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.