Cody Bable

Generation

generate functionThu, 13 Apr 2023

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

def seperate_list(l): l1 = [] l2 = [] l3 = [] for i in l: if i.isdigit(): l1.append(i) elif i.isalpha(): l2.append(i) else: l3.append(i) return l1, l2, l3

Questions about programming?Chat with your personal AI assistant