16,395 questions
21,880 answers
573 users
lst = [34, 78, 90, 'python', 'java', 'c++'] item = 'python' index = lst.index(item) print(index) ''' run: 3 '''
lst = [34, 78, 90, 'python', 'java', 'c++'] item = 'c#' try: index = lst.index(item) print(index) except ValueError: print('Item not exist it the list') ''' run: Item not exist it the list '''