Python len() FunctionThe python len() function is used to return the length (the number of items) of an object. SignatureParametersobject: An object that must be a sequence(string, tuple, list etc.) or a collection(dictionary, set etc.) ReturnIt returns the length (the number of items) of an object. Python len() Function Example 1The 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 2The below example shows the length of list. Output: 4 Python len() Function Example 3The below example shows the length of dictionary. Output: 3
Next TopicPython Functions
|