YouTip LogoYouTip

Python String Length

# Python3.x Python Determine String Length [![Image 3: Document Object Reference](#) Python3 Examples](#) Given a string, determine the length of that string. ## Example 1: Using the Built-in Method len() ```python str = "" print(len(str)) Executing the above code outputs: 6 ## Example 2: Using a Loop to Calculate ```python def findLen(str): counter = 0 while str[counter:]: counter += 1 return counter str = "" print(findLen(str)) Executing the above code outputs: 6 [![Image 4: Document Object Reference](#) Python3 Examples](#)
← Arrays_MergeString Format β†’