Tuple
warning
Only supported in python
- ordered
- unchangeable (immutable)
- can have duplicates
Initialization
t = ("apple", 2, True)
t = tuple(("apple", 2, True))
t = tuple([])
note
t1 = ("apple",) ✅
print(type(t1)) # <class 'tuple'>
t2 = ("apple") ❌
print(type(t2)) # <class 'str'>
Access
t[0] # apple
Others
len(t)