Generation

generate functionTue, 27 Dec 2022

filter a list of tuples where first item in the tuple has a key 'code' that only begins with "1 or 2 or 3"

def filter_list(list_of_tuples): return [x for x in list_of_tuples if x[0] == 'code' and x[1] in ['1', '2', '3']]

Want to kickstart your project?Use the new AI Studio to create your code