102 views

1 Answer

0 0 votes

Initially, inside the function:

a = 2
b = 5

The statement below uses tuple unpacking.

a, b = b, a + b

The right side is evaluated first.

b = 5
a + b = 2 + 5 = 7

So after unpacking:

a = 5
b = 7

The function returns:

a, b, a + b = 5, 7, 12

These three returned values are unpacked into $\texttt{x}$, $\texttt{y}$, and $\texttt{z}$.

Therefore, the output is:

5 7 12

Correct Option: A

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
131
131 views
GO Classes asked Jun 20
131 views
Consider the following Python code:t = ("GATE", 2027, "DA", 3.5) single = ("AI",) print(t[0], t[-2], t[1:3], len(single))What is the output of the code above?GATE 2027 ('...
0 0 votes
1 1 answer
126
126 views
GO Classes asked Jun 20
126 views
Consider the following Python code:def process(*nums): f = lambda x, y: x + 2 * y pairs = zip(nums, nums[1:]) return tuple(f(a, b) for a, b in pairs) print(process(1, 3, ...
2 2 votes
1 1 answer
98
98 views
GO Classes asked Jun 20
98 views
Consider the following Python code:print("GO", "Classes", sep="-", end="|") print("GATE", "DA", sep=" ", end="!") print("Done")What is the output of the code above?GO Cla...
0 0 votes
1 1 answer
118
118 views
GO Classes asked Jun 20
118 views
Consider the following Python code:def func(a, b=5, c=10, d=20): print("a =", a, "b =", b, "c =", c, "d =", d) func(2, c=30) func(c=4, a=1, d=6)What is the output of the ...