High-Order Functions in Python: Passing Functions as Arguments
def square(x): return x * x numbers = [1, 2, 3, 4, 5] squared_numbers = map(square, numbers) # Convert the map object to a list squared_numbers_list = list(squared_numbers) print(squared_numbers_list)
Opgave
Swipe to start coding
Løsning
Var alt klart?
Tak for dine kommentarer!