Hey whats the function of the index here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Hey whats the function of the index here?

29th Jun 2019, 12:00 PM
Chethan Abishek
Chethan Abishek - avatar
4 Answers
+ 4
The index function returns the position of a certain item inside a list. Example: ———————————— # Create a list list = ['a','b','c','d'] # Find a certain item in the list, in this case, the letter b print(list.index('b')) # Output >>>1 # Info: 1 is returned because python counts list items from 0, not 1 ———————————— Hope this helps 😊
29th Jun 2019, 12:37 PM
aceisace
aceisace - avatar
+ 3
Thx so much man. I really appreciate it✌
29th Jun 2019, 12:38 PM
Chethan Abishek
Chethan Abishek - avatar
+ 3
Glad to be of help 😊
29th Jun 2019, 12:42 PM
aceisace
aceisace - avatar
+ 3
👍🤘
29th Jun 2019, 12:44 PM
Chethan Abishek
Chethan Abishek - avatar