Python len() method syntax
You can use len() method to get the length of a given string, array, list, tuple, dictionary, etc. It is allowed to have a null-character string written the same '' " as an empty string. The length of the empty string is 0.
- object: specified sequence or collection
How to find the length of a string using a for loop in Python?
Using a for loop, we can iterate over each character in the string one by one. Initialize one counter variable with an initial value of zero. Keep incrementing this counter variable by one for each character as you iterate. At the end of the loop, the counter will record the length of the string.