Q:

Swap two tuples in Python

belongs to collection: Python Tuple Exercises

0

Swap two tuples in Python

Given:

tuple1 = (11, 22)
tuple2 = (99, 88)

Expected output:

tuple1: (99, 88)
tuple2: (11, 22)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

tuple1 = (11, 22)
tuple2 = (99, 88)
tuple1, tuple2 = tuple2, tuple1
print(tuple2)
print(tuple1)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a python program to copy elements 44 and 55 ... >>
<< Write a python program to unpack the following tup...