Tuple Data Type in Python
Concept
Tuple is a collection which is immutable, ordered and unchangeable. Allows duplicate members
Code Example
Example 1:
>>> t = ()
>>> t
()
>>> type(t)
<class 'tuple'>
>>> t = (10, 20.35, 'Hello', [1, 2])
>>> t
(10, 20.35, 'Hello', [1, 2])
Example 2:
>>> t = (10, 20.35, 'Hello', [1, 2])
>>> len(t)
4
Comments
Post a Comment