Tuples
In this lecture, you'll learn everything about Python tuples. More specifically, what are tuples, how to create them, when to use them and various methods you should be familiar with.
Creating a Tuple
# Different types of tuples
empty_tuple = ()
tuple_with_ints = (1, 2, 3)
tuple_with_floats = (1.1, 2.2, 3.3)
tuple_with_strings = ("a", "b", "c")
tuple_with_lists = ([1, 2, 3], [4, 5, 6], [7, 8, 9])
tuple_with_tuples = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
mix_tuple = (1, 2.2, "a", [1, 2, 3], (1, 2, 3))Access Tuple Elements
Changing a Tuple
Deleting a Tuple
Tuple Methods
Method
Description
Other Tuple Operations
Advantages of Tuple over List
Last updated