Cody Bable

Generation

generate functionThu, 13 Apr 2023

divide list ['a', 'b', 'c', '1', '2', '3'] into three separate list

def separate(lst, *args): return [x for x in lst if x in args] separate(['a', 'b', 'c', '1', '2', '3'], 'a', 'b', 'c')

Questions about programming?Chat with your personal AI assistant