Avatar

#2 Python Data Types : Tuple | Tuples | Python Learning

By Jaydeep Karale on youtube.com

More about this content:

#tuples #python #datatypes #pythonprogramming Next in line of the Python Data Types are tuples which offer improved performance in case of fixed data that needs to be stored. Tuples are immutable and hence the best choice when you want to store data which is fixed in nature for example genders, order statuses for an e-commerce website or ticket reservation status on ticketing sites and so on. So, in summary tuples are used to store homogeneous or heterogeneous data which is always going to remain same. 1) Tuples are immutable and can be created by enclosing data within round brackets. 2) Tuples offer better performance 3) The tuple API offers all data several methods such a min, max, len, contains and so on. More can be found using help(tuple) 4) Tuple unpacking is powerful and can help unpack data from a tuple into multiple variables. 5) The * operator can be used to grab excess data from a tuple into a single variable. 6) Tuples are very useful for storing record type data.

READ MORE
Visit