Course Content
Python Data Structures
Python Data Structures
Concatenating Tuples
In Python, it's possible to combine tuples. This involves forming a new tuple by merging two or more existing ones. You can accomplish this with the +
operator. Here's an example to illustrate.
movie_titles = ("Inception", "Interstellar", "Dunkirk") release_years = (2010, 2014, 2017) # Concatenate the tuples combined_tuple = movie_titles + release_years print(combined_tuple)
Swipe to show code editor
Create another tuple named availability
containing the values 3
(number of available copies) and "Shelf B2"
(storage location). Then, concatenate the availability
tuple with the movie_details
tuple, and print the resulting combined tuple.
Thanks for your feedback!
Concatenating Tuples
In Python, it's possible to combine tuples. This involves forming a new tuple by merging two or more existing ones. You can accomplish this with the +
operator. Here's an example to illustrate.
movie_titles = ("Inception", "Interstellar", "Dunkirk") release_years = (2010, 2014, 2017) # Concatenate the tuples combined_tuple = movie_titles + release_years print(combined_tuple)
Swipe to show code editor
Create another tuple named availability
containing the values 3
(number of available copies) and "Shelf B2"
(storage location). Then, concatenate the availability
tuple with the movie_details
tuple, and print the resulting combined tuple.
Thanks for your feedback!
Concatenating Tuples
In Python, it's possible to combine tuples. This involves forming a new tuple by merging two or more existing ones. You can accomplish this with the +
operator. Here's an example to illustrate.
movie_titles = ("Inception", "Interstellar", "Dunkirk") release_years = (2010, 2014, 2017) # Concatenate the tuples combined_tuple = movie_titles + release_years print(combined_tuple)
Swipe to show code editor
Create another tuple named availability
containing the values 3
(number of available copies) and "Shelf B2"
(storage location). Then, concatenate the availability
tuple with the movie_details
tuple, and print the resulting combined tuple.
Thanks for your feedback!
In Python, it's possible to combine tuples. This involves forming a new tuple by merging two or more existing ones. You can accomplish this with the +
operator. Here's an example to illustrate.
movie_titles = ("Inception", "Interstellar", "Dunkirk") release_years = (2010, 2014, 2017) # Concatenate the tuples combined_tuple = movie_titles + release_years print(combined_tuple)
Swipe to show code editor
Create another tuple named availability
containing the values 3
(number of available copies) and "Shelf B2"
(storage location). Then, concatenate the availability
tuple with the movie_details
tuple, and print the resulting combined tuple.