How do I merge tuples in Python with examples?

In Python, you can merge tuples by using the `+` operator or by converting them into a list and then combining them. Below are examples demonstrating both methods.

# Method 1: Using the + operator tuple1 = (1, 2, 3) tuple2 = (4, 5, 6) merged_tuple = tuple1 + tuple2 print(merged_tuple) # Output: (1, 2, 3, 4, 5, 6) # Method 2: Using list conversion tuple1 = (7, 8, 9) tuple2 = (10, 11, 12) merged_tuple = tuple(list(tuple1) + list(tuple2)) print(merged_tuple) # Output: (7, 8, 9, 10, 11, 12)

merge tuples Python tuples combining tuples