Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
479 B
1
Indexable
Never
def reverse_tuple(tup):
    return tuple(reversed(tup))

def swap_tuples(tup1, tup2):
    return tup2, tup1

# Example usage:
tuple1 = (1, 2, 3)
tuple2 = (4, 5, 6)

print("Original tuple 1:", tuple1)
print("Reversed tuple 1:", reverse_tuple(tuple1))

print("Original tuple 2:", tuple2)
print("Reversed tuple 2:", reverse_tuple(tuple2))

print("Tuples before swapping:", tuple1, tuple2)
tuple1, tuple2 = swap_tuples(tuple1, tuple2)
print("Tuples after swapping:", tuple1, tuple2)
Leave a Comment