0

If in lists two element is repeated , index of its first place is shown, why??

l=['a','b','c','a','s'] print(l.index('a'))=0 why it's only 0 (3 should also be their)

22nd Oct 2018, 1:03 PM
Divam kachoria
Divam kachoria - avatar
1 Respuesta
+ 7
It's just how the index method works. It returns the index of the first occurrence of the element.
22nd Oct 2018, 1:10 PM
Nikhil
Nikhil - avatar
En tendencia hoy
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes