Cody Bable

Generation

generate functionThu, 13 Apr 2023

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

def split(lst): a = [lst[i] for i in range(len(lst)) if lst[i] in 'abcABC'] b = [lst[i] for i in range(len(lst)) if lst[i] not in 'abcABC'] return a, b

Questions about programming?Chat with your personal AI assistant