6.0 Python: Join Tuples
6.1 Join Two Tuples
To join two or more tuples you can use the +
operator:
6.1.1 Example
Join two tuples:
tuple1 = ("a", "b", "c")
tuple2 = (1, 2, 3)
tuple3 = tuple1 + tuple2
print(tuple3)
6.2 Multiply Tuples
If you want to multiply the content of a tuple a given number of times, you can use the *
operator:
6.2.1 Example
Multiply the fruits tuple by 2:
fruits = ("apple", "banana", "cherry")
mytuple = fruits * 2
print(mytuple)