Python Program to Find the Length of a Tuple

Find length of words in tuple. It will print the number of letters in output and text is entered in the program. In Python, a list is an ordered and changeable collection data type. A list can also include duplicate entries. The len() function in Python is used to determine the length of any object.

Tuples in Python

Tuples are a type of data structure in Python that stores an ordered list of values. Tuples are unchangeable. This means that the values in a tuple cannot be changed. They allow you to keep a list of items in a specific order. A tuple is a set of values separated by a comma and enclosed in brackets. 

Tuples, unlike lists, are immutable. The immutability of tuples can be considered a distinguishing feature. With examples, I’ll go over the characteristics of tuples and how to operate on them.

Program to Find Length of Words in Tuple

The length of a list, string, dictionary, or any other iterable data format in Python is returned by the len() Python method. The len() method in Python is a built-in function for calculating the length of any iterable object. 

The length of a string, or the number of characters in it, is returned by the len() function. The empty string has a length of 0. In Python, the len() function is ubiquitous; it’s used to get the length of any data type, with string being just one example.

The len function calculates how many characters are in a given text string. len  only accepts one argument: text. len returns a number based on the number of characters in text, including spaces and punctuation. len ( list ) The List parameter is used to count the number of elements in a list. The number of elements in the list is returned.

tuplea = tuple("inlarn.com")
print(tuplea)
print(len(tuplea))

Output:

(‘i’, ‘n’, ‘l’, ‘a’, ‘r’, ‘n’, ‘.’, ‘c’, ‘o’, ‘m’) 

10