← Python from Scratch
Lesson 12 of 78 · 5 XP
Warm-up: word length warm-up
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
len() counts how many characters a string has:
print(len("cat")) # 3
print(len("Python")) # 6
A space is a character too: len("a b") is 3.
Task. Read a word and print how many letters it has.
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.