1

I have a tuple that consists of a list of tuples where each tuple has a string and a list of strings. I need to write a function that goes through each tuple, and for each tuple it has to check if the input word is in that list. This is a shortened version of the list:

check = [
    ("fruit",["apple", "pear", "banana"]),
    ("berries",["strawberry", "raspberry", "blueberry"]) ]

and this is what my desired function should do:

convert "apple" = "fruit"

Any advice? Should I use a case lookup function or should I use a higher order function such as map? I'm a beginner, so any help or advice is appreciated.

Will Ness
  • 70,110
  • 9
  • 98
  • 181
amonmi
  • 17
  • 3

0 Answers0