I have the following piece of code which I want to simplify/write more clean using list comprehension.
How would I achieve this?
How would I achieve this?
type_list = [] input = [['car', 'red', '10'], ['train', 'blue', '20'], ['airplane', 'gray', '300']] if input is not None: for entry in input: if entry[0] != 'car': type_list.append(entry[0]) else: type_list.append(None) return type_list