Complete the code to create a numpy array and apply the square root ufunc.
import numpy as np arr = np.array([1, 4, 9, 16]) sqrt_arr = np.[1](arr) print(sqrt_arr)
The sqrt function computes the square root of each element in the array.
Complete the code to apply the numpy ufunc that calculates the exponential of each element.
import numpy as np arr = np.array([0, 1, 2]) exp_arr = np.[1](arr) print(exp_arr)
The exp function calculates the exponential (e^x) of each element in the array.
Fix the error in the code by choosing the correct numpy ufunc to calculate the absolute values.
import numpy as np arr = np.array([-1, -2, 3]) abs_arr = np.[1](arr) print(abs_arr)
The correct numpy ufunc for absolute values is absolute (with abs as an alias).
Complete the code to apply the numpy ufunc that calculates the base-10 logarithm of each element.
import numpy as np arr = np.array([1, 10, 100]) log_arr = np.[1](arr) print(log_arr)
The log10 ufunc computes the base-10 logarithm of each element in the array.
Complete the code to apply the floor ufunc, which rounds each element down to the nearest integer.
import numpy as np arr = np.array([0.7, 1.5, -1.8, -0.1]) floor_arr = np.[1](arr) print(floor_arr)
The floor ufunc rounds each element towards negative infinity to the nearest integer.