What does index mean in python?
python, python-3.x
Solution
An index, in your example, refers to a position within an ordered list. Python strings can be thought of as lists of characters; each character is given an index from zero (at the beginning) to the length minus one (at the end).
For the string "Python", the indexes break down like this:
P y t h o n
0 1 2 3 4 5
In addition, Python supports negative indexes, in which case it counts from the end. So the last character can be indexed with `-1`, the second to last with `-2`, etc.:
P y t h o n
-6 -5 -4 -3 -2 -1
Most of the time, you can freely mix positive and negative indexes. So for example, if you want to use `find` only from the second to second-to-last characters, you can do:
"Python".find("y", beg=1, end=-2)
Problem
Perhaps, it sounds like a stupid question. However, I have to learn what index is because I want to learn python. For example, in a website, I saw this: The method find() determines if string str occurs in string, or in a substring of string if starting index beg and ending index end are given. http://www.tutorialspoint.com/python/string_find.htm What does "index" mean here? I would like you to explain it to me like you are explaining something to a child. Because my comprehension is somewhat bad. Anyway. You can even provide examples to explain what index is. Many thanks.