Operations with NumPy arrays
The following blocks of code create new lists given input lists input_list1, input_list2, input_list3 (you can check their values in the console). If you had analogous NumPy arrays with the same values input_array1, input_array2, input_array3 (you can check their values in the console), how would you create similar output as NumPy arrays using the knowledge on broadcasting, accessing element in NumPy arrays, and performing element-wise operations?
Block 1
list(map(lambda x: [5*i for i in x], input_list1))
Block 2
list(filter(lambda x: x % 2 == 0, input_list2))
Block 3
[[i*i for i in j] for j in input_list3]
Deze oefening maakt deel uit van de cursus
Practicing Coding Interview Questions in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Substitute the code in the block 1 given the input_array1
output_array1 = ____
print(list(map(lambda x: [5*i for i in x], input_list1)))
print(output_array1)