About index | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

About index

Can you help me out with python indexes? You can give me examples of codes just to understand well.

16th Apr 2020, 8:03 AM
Aaron Luke Olvida🇵🇭
Aaron Luke Olvida🇵🇭 - avatar
3 Answers
+ 2
Index is the positional value assigned to any element in an iterable such as string, list, etc. it always start from zero It is used to reach an element with it's address...via typing iterable_name[index] for eg. >>>list = [2,6,1,9,8] >>>print(list[2]) 1
16th Apr 2020, 10:20 AM
Varun Vaswani
Varun Vaswani - avatar
+ 1
Python indexes.
16th Apr 2020, 9:38 AM
Aaron Luke Olvida🇵🇭
Aaron Luke Olvida🇵🇭 - avatar
+ 1
Think to the index of a list as the floor number of a building: the first element is the ground (level 0), the 1st floor is the second element, and so on... ;)
16th Apr 2020, 3:44 PM
visph
visph - avatar