Computer Science, asked by Emilinsyju, 4 months ago

write the output of the following T1=(1, 2,3) T2=(10, 20,30)T1, T2=T2, T1print(T1, '\n', T2) ​

Answers

Answered by surajnegi0600
1

Answer:

The output of the following code:

T1=(1, 2,3)

T2=(10, 20,30)

T1, T2=T2, T1

print(T1, '\n', T2)

Will be:

(10, 20, 30)

(1, 2, 3)

Explanation:

This code creates two tuples, T1 and T2, containing the values (1, 2, 3) and (10, 20, 30) respectively. Then the code performs tuple unpacking and assigns T1 to T2 and T2 to T1. Lastly, it prints the values of T1 and T2, which will display the values of the tuples after they have been swapped.

In summary, the code is swapping the values of T1 and T2 by using tuple unpacking method. The first tuple is assigned to the second one and second one is assigned to the first tuple. And then it is printing the values of T1 and T2 which will have the values of the tuples after they have been swapped.

More questions and answers

https://brainly.in/question/38820675

https://brainly.in/question/38820566

#SPJ1

Similar questions