List Index in Python
Level 254 keystrokes
This finds the index of the first occurrence of a value in a list using the index() method.
Python code
# Create a list with some duplicate values1fruits = ["a", "b", "c", "b"]# index() returns the position of the first occurrence# "b" first appears at index 1 (second position)2print(fruits.index("b"))Output
1
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 10,× 3(× 2)× 2.× 1[× 1]× 1=× 1