Length of a tuple in Python
To find the length of a tuple, you should apply the len
function:
tpl = ('a', 'b', 'c')
print(len(tpl)) # 3
A tuple is given:
tpl = ('1', 'b', '3', 'd', '5')
Find its length.
A tuple is given:
tpl = (1, 2, 3)
Print the number of elements in this tuple.