Knowledge organisersString Manipulation
Measure size of string.
len() returns the number of characters in a string, including spaces and punctuation. It is commonly used for validation and loop control.
len("hello") → 5len("hi there") → 8len("") → 0name = input("Username: ")
if len(name) < 3:
print("Too short — at least 3 characters")
else:
print("Welcome, " + name)