Python - Join Tuples
Join Two Tuples
To join two or more tuples you can use the +
operator:
ExampleGet your own Python Server
Join two tuples:
tuple1 = ("a", "b" , "c")
tuple2 = (1, 2, 3)
tuple3 = tuple1 + tuple2
print(tuple3)
Try it Yourself »
Multiply Tuples
If you want to multiply the content of a tuple a given number of times, you can use the *
operator:
Example
Multiply the fruits tuple by 2:
fruits = ("apple", "banana", "cherry")
mytuple = fruits * 2
print(mytuple)
Try it Yourself »
Exercise?What is this?
Test your skills by answering a few questions about the topics of this page
What is a correct syntax for joining tuple1
and tuple2
into tuple3
?