I am trying to do a search function for a 2 dimension array or list. How do I search thru this list and return the values of the items.
myfoodlist = [("Chicken Pasta", 10),("Beef Noodle", 12),("Hot Coffee", 4.20),( "Fish and Chips", 8.50)]
foodsearch = raw_input("Please input food to search: ")
for item in (myfoodlist) :
if item.find(foodsearch) != -1:
searchReturnsItems.append(item)
for item in searchReturnsItems:
print(item, "\t:\t")
searchReturnsItems.clear()
Example
I like to ask for a key word like "beef" and return a list of all beef items and store in array.
Above is my code and I have some challenges.
Anyone can provide me an example to search a 2D array will be helpful