Write A Program To Input Any Two Tuples And Interchange The Tuple Variable
# program to input any two tuples and interchange the tuple variable
tuple1_length = int(input("Enter First Tuple Length :"))
tuple1 = ()
for x in range(tuple1_length):
item = input("Enter Tuple1 Item :")
tuple1 += (item,)
tuple2_length = int(input("Enter Second Tuple Length :"))
tuple2 = ()
for x in range(tuple2_length):
item = input("Enter Tuple2 Item :")
tuple2 += (item,)
print("Tuples Before Interchange Tuple1 : ", tuple1, " Tuple2 : ", tuple2)
tuple1, tuple2 = tuple2, tuple1
print("Tuples After Interchange Tuple1 : ", tuple1, " Tuple2 : ", tuple2)
0 Comments