Length method len() is a ready made function available in python. we can use the len() method to find out the length of a given string, tuple, dictionary, array, list, etc.

In short notes as per the the python programming, len method returns the length of a given input character.

**Syntax:**

len(string)

**Parameters:**

Value: the input value which you want the length of.

**Return value:**

len() method will return an integer value i.e. the length of a given input like string, or array, or list or collections.

Now let’s go through top 5 python examples to find the length.

Contents

**Python Examples for len() Method**

**Find the string length of a given input in python**

The following example code illustrates to find a python string length based on the given input character.

Here we are providing the desired the string using variable “input”, so the program calculates the total string length finally as output.

```
input = "Welcome to Python Tutorials of TraceDynamics"
print("The python string length is :", len(input))
```__Output:__
The python string length is : 44

As per the output, the string length is calculated as 44.

**Find the length of a python tuple**

Here is the python program which finds the length of a given tuple input character.

```
tuple = ('Monday','Tuesday','Wednesday')
print("The length of the input tuple is :", len(tuple))
```__Output:__
The length of the input tuple is : 3

**Find the length of a python list**

Here is the program which finds the length of a python list input.

```
list = ["Jim","Nick","Rob","Sam"]
print("The length of the input list is :", len(list))
```__Output:__
The length of the input list is : 4

**Find the length of a python dictionary**

Here is the program which finds the length of a python dictionary input.

```
dictionary = {'Sam': 12,'Jim':14,'Smith':18,'Rob':28,'Shah':15}
print("The length of the input dictionary is :", len(dictionary))
```__Output:__
The length of the input dictionary is : 5

**Find the length of an python array element**

```
array = ['Sam','Mike','Nair']
print("The length of input dictionary is :", len(array))
```__Output:__
The length of the input dictionary is : 3

To conclude, in this python tutorial we gone through top 5 examples to find string length using python len function.

Keeping sharing tutorials and happy coding 🙂