Question 4
Back to Exercise
The program below stops with an error. Which statement correctly describes the problem?
line = "Ravi,78"
name, marks, grade = line.split(",")
print(name, marks, grade)
- A It prints Ravi 78 None
- B ValueError: split gives 2 values but 3 names are waiting Correct
- C TypeError: split returns a list
- D IndexError: list index out of range
Correct Answer: Option B
Missing values are not filled with None. Check len() first, or use a starred name.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!