# Prompt for a search item and search the list for # a match on type and value mylist=["okra","swede","cabbage","potato","tomato","carrot", "parsnip","broccolli","swede"] search_term=raw_input("Enter an item to search for: ") print print "Searching the list for \"%s\" ..." % search_term # # Locate the search term print if not search_term in mylist: print "The search term doesn't appear in the list" else: count = mylist.count(search_term) if count == 1: idx = mylist.index(search_term) print "There is a single occurance of the search term at position",idx else: print "There are %d occurances of the search term" % count idxlist = [] idx = 0 for x in range(count): idx = mylist.index(search_term,idx) idxlist.append(idx) idx += 1 print "These are at the following positions: ",idxlist