• Q & A – Python Tuple

    Q & A – Python Tuple

    (1) What Is A Tuple Data Structure? Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. Tuples are used to store multiple items in a single variable. A tuple is a collection which is ordered and unchangeable. Example-1 tp = (1,’abc’,4.5,[9,8]) print(type(tp)) print(tp) <class ‘tuple’> (1, ‘abc’, 4.5, [9, 8]) (2) Find The Size Of The Tuple In Python. getsizeof() Function can be used to get the size of the tuple. The getsizeof() function belongs to the python’s sys module. Example-1 import sys

    Read More