Question 8
Back to Exercise
The program below stops with an error. Which statement correctly describes the problem?
ranks = ("Asha", "Ravi", "Meera")
print("Kiran is rank", ranks.index("Kiran") + 1)
- A It prints Kiran is rank 0
- B It prints Kiran is rank -1
- C ValueError: index() raises when the value is absent; check "Kiran" in ranks first Correct
- D IndexError
Correct Answer: Option C
Tuples have no find(); test membership before calling index().
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!