note that the pn variable includes a list of tuples. Each tuple listed has an index of 0 and 1. With this knowledge in hand, we can iterate through each tuple in the list and perform a search. We also know where to search, the first item of each tuple. Note that by default, each tuple and list begins with an index of 0. Thus, this is where we’ll be doing our search for the word case.
for index, string in enumerate(pn):
if 'case' in string[0]:
print(str(index + 1) + ' ' + string[0] + ' ' + string[1])
After running this script, you get:
1 Samsung Galaxy phone case 28
2 MacBook Air case 30
7 iPhone 11 case 20