Predict String Split
Predict Output Easy
Question
What does this code print?
Code
csv = "a,b,c,d"
parts = csv.split(",")
print(parts)
print(len(parts))
Hint
split() breaks the string at each delimiter.
Explanation
split(",") breaks the string at each comma, producing ["a", "b", "c", "d"]. len(parts) is 4. Output: ['a', 'b', 'c', 'd'] then 4.
Related Resources
Related Lessons
- Strings
String split.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.