Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to print an index in python

animals = ['cat', 'dog', 'rabbit', 'horse']

# get the index of 'dog'
index = animals.index('dog')


print(index)

# Output: 1
1
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #print #index #python
ADD COMMENT
Topic
Name
6+2 =