Python len() function

The len() function in Python  returns the number of items in an object.

Syntax

Parameter

s: This parameter represents a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

Return

This function returns the length (the number of items) of an object.

Example 1

Output

Example 2

Output

 

Pin It on Pinterest

Share This