LEN()

The len() function is used to determine the number of items contained within an object, making it one of the most commonly used built-in functions for working with strings, lists, tuples, dictionaries, and other iterable types. When used on a string, len() returns the total number of characters, including spaces and special symbols. For collections like lists or tuples, it returns the count of elements, and for dictionaries, it returns the number of key–value pairs. For example, len("Hello") evaluates to 5, while len([1, 2, 3]) returns 3. The len() function is essential for tasks such as iterating through data structures, validating input length, checking buffer sizes, and managing boundaries in algorithms. In cybersecurity and reverse engineering, it can help measure input sizes during fuzzing or ensure that string lengths match expected protocol or file-format specifications.

#!/usr/bin/env python3

def main() -> None:
    txt = "NumeroTres";
    print(len(txt));
    
if __name__ == "__main__":
    main();
    
 * OUTPUT
    10

Last updated