+ 3

What is index in Python?

Please answer that question

3rd Jul 2019, 2:16 PM
Reza.ES
Reza.ES - avatar
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 😊
3rd Jul 2019, 2:44 PM
aceisace
aceisace - avatar
+ 4
morteza , you‘re welcome 😊
3rd Jul 2019, 6:33 PM
aceisace
aceisace - avatar
+ 3
Thanks🙏🙏
3rd Jul 2019, 2:45 PM
Reza.ES
Reza.ES - avatar