Write a function that acts like a ReLU function for a 1D array


Topic: Write a function that acts like a ReLU function for a 1D array

Solution

def relu_list(input_list:list)->list:
    return [(lambda x: x if x >= 0 else 0)(x) for x in input_list]



List all Python Programs