CBSE Class 11 Computer Science
Question 54 of 91
String Manipulation — Question 14
Back to all questions 14
Question Question 14
Can you specify an out of bound index when accessing a single character from a string? Why?
Answer
We cannot specify an out of bound index when accessing a single character from a string, it will cause an error. When we use an index, we are accessing a constituent character of the string. If the index is out of bounds there is no character to return from the given index hence Python throws string index out of range error.