1greeting = ['hello','my','name','is','bob','how','are','you','my','name','is']
2
3def find_sub_list(sl,l):
4 results=[]
5 sll=len(sl)
6 for ind in (i for i,e in enumerate(l) if e==sl[0]):
7 if l[ind:ind+sll]==sl:
8 results.append((ind,ind+sll-1))
9
10 return results
11
12print find_sub_list(['my','name','is'], greeting)
13# [(1, 3), (8, 10)]
14
1#Example List
2list = ['apples', 'bannas', 'grapes']
3#Use Known Entites In The List To Find The Index Of An Unknown Object
4Index_Number_For_Bannas = list.index('apples')
5#Print The Object
6print(list[Index_Number_For_Bannas])
7