What is meant by string indices must be integers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is meant by string indices must be integers?

17th Mar 2022, 11:52 AM
CML
CML - avatar
1 Answer
0
To answer this question you can think of a problem where you start counting from 0 to onwards , the first thing that comes to mind is whenever you start counting a similar group of objects you say 1,2,3,4....n Similarly when you count anything in programming , let's say in this scenario a string , which is a group of characters you start to count but this time from 0 . You don't say 1.1,1.2,1.3 as that is not easy to follow for the designer of the language himself or neither to you .
17th Mar 2022, 12:39 PM
Deba Shankar Pati
Deba Shankar Pati - avatar