DEV Community

loading...
Cover image for INDEX(PYTHON3)

INDEX(PYTHON3)

francnstein profile image francnstein ・1 min read

I am working on an archive of things I am learning on the way and a quick and simple resource, This is not my first time learning to code but it was short lived, why? Because I was intimidated by all of the information.

index() is an inbuilt function in Python, which searches for given element from start of the list and returns the lowest index where the element appears. Parameters : element - The element whose lowest index will be returned. start (Optional) - The position from where the search begins.

---------------------------------------------------->

letters = ['A','B','C','D','E']
print(letters.index('C'))
print(letters.index('A'))
print(letters.index('E'))
print(letters.index('D'))

2
0
4
3

geeksforgeeks.org
SOLOLEARN
FRANCNSTEIN Β© 2020 | Created 𝗐𝗂𝗍𝗁 ❀

Discussion (0)

pic
Editor guide