Javatpoint Logo
Javatpoint Logo

Python len() Function

The python len() function is used to return the length (the number of items) of an object.

Signature

Parameters

object: An object that must be a sequence(string, tuple, list etc.) or a collection(dictionary, set etc.)

Return

It returns the length (the number of items) of an object.

Python len() Function Example 1

The below example shows the length of string.

Output:

6

Explanation: The above example returns the length of a string strA by using len() function.

Python len() Function Example 2

The below example shows the length of list.

Output:

4

Python len() Function Example 3

The below example shows the length of dictionary.

Output:

3

Next TopicPython Functions





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA