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

</>
Copy
tupleObject = ('A', 'B', 'C', 'D')
length = len(tupleObject)
print(f'Length of this tuple is {length}.')

Output

Length of this tuple is 4.

Conclusion

In this Python Tutorial, we learned how to find the length of tuple using len() function, with example program.