Function Details: len

Description


Returns the length (the number of items) of an object.


Extended Description


The len() function returns the number of items in an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set). For mappings, len() returns the number of keys. For custom objects, len() calls the object's __len__() method.


Read More about len from Python Documentation

Function Signature


len(s: Sized) -> int

Module: builtins

Parameters



Parameter List


  • s: Sized

Return


Returns an integer representing the length of the object.


Return Type


int

Output

Explanation

This example demonstrates using len() with various built-in types.