Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren+ 3
What is index in Python?
Please answer that question
3 Antworten
+ 6
Index means position in python. For example:
———————————-
list = [‘a’, ‘b’, ‘c’, ‘d’]
list.index(‘c’)
>>> 2
————————————
Explanation: On which position is the letter b in the list? Answer: 2 (2nd position)
Attention: In Python, index starts from 0, not 1. So although b is the third element, the output is 2.
Hope this helps, morteza 😊
+ 4
morteza , you‘re welcome 😊
+ 3
Thanks🙏🙏