w3resource logo


Python Exercises

Python Exercise: Find the length of a tuple

Python tuple: Exercise-15 with Solution

Write a Python program to find the length of a tuple.

Sample Solution :-

Python Code :

>>> #create a tuple
>>> tuplex = tuple("w3resource")
>>> print(tuplex)
>>> #use the len() function to known the length of tuple
>>> print(len(tuplex))

Output:

>>>
('w', '3', 'r', 'e', 's', 'o', 'u', 'r', 'c', 'e')
10                                         
>>>

Python Code Editor:

#create a tuple
tuplex = tuple("w3resource")
print(tuplex)
#use the len() function to known the length of tuple
print(len(tuplex))

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program