Python – Length of Tuple
To find the length of a tuple in Python, call len() builtin function and pass the tuple object as argument. len() function returns the number of items in the tuple.
Reference – Python len() builtin function
Example
In the following example, we will take a tuple with some items in it, and find its length using len() function.
Python Program
tupleObject = ('A', 'B', 'C', 'D') length = len(tupleObject) print(f'Length of this tuple is {length}.')Try Online
Output
Length of this tuple is 4.
ADVERTISEMENT
Conclusion
In this Python Tutorial, we learned how to find the length of tuple using len() function, with example program.