Tuples

Tuples are similar to lists. To make a tuple, we use parentheses, (). Example: my_tuple = (1, 2, 3). The main difference between tuples and lists is that tuples are immutable, so we cannot change any components of a tuple. If we tried my_tuple[0] = 4, an error would be thrown. Because their values are immutable, tuples are useful for setting constant variables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset