
Day 5 of Python(Tuple)
via Dev.to PythonVIDHYA VARSHINI
What is tuple: It is a collection of items which is ordered, immutable and allows duplicates. This can also store different data types. A tuple can be identified when it is separated by a comma and no need of bracket. Ex: num = 1,2,3,4,5,6 print(num[2:5]) print(num[3]) Output: (3,4,5) 4 Single tuple: A tuple with only one item is called a single tuple. Ex: num = (1,) print(type(num) ) Output: <class 'tuple'>
Continue reading on Dev.to Python
Opens in a new tab
7 views


