Take comma separated multiple integer values as input using argparse and check if any of those values are present in a list

Once you have the user input integers in a tuple, you can do this:

user_input = (1, 2)
L1 = [["Apple", 1, 200], ["Grapes", 4, 100], ["Banana", 1, 20]]

for i in user_input:
    for sublist in L1:
        if i == sublist[1]:
            print(sublist)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top