Complete the code to calculate the square root of each number in the array.
import numpy as np numbers = np.array([4, 9, 16, 25]) sqrt_values = np.[1](numbers) print(sqrt_values)
The np.sqrt function calculates the square root of each element in the array.
Complete the code to calculate the natural logarithm of each number in the array.
import numpy as np values = np.array([1, 10, 100, 1000]) log_values = np.[1](values) print(log_values)
The np.log function calculates the natural logarithm (base e) of each element.
Fix the error in the code to calculate the exponential of each number in the array.
import numpy as np values = np.array([0, 1, 2, 3]) exp_values = np.[1](values) print(exp_values)
The np.exp function calculates the exponential (e to the power) of each element.
Fill both blanks to create a dictionary with words as keys and their lengths as values, but only for words longer than 3 letters.
words = ['apple', 'bat', 'carrot', 'dog'] lengths = {word: [1] for word in words if len(word) [2] 3} print(lengths)
The dictionary comprehension uses len(word) to get the length and filters words with length greater than 3 using >.
Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values, only for words longer than 3 letters.
words = ['apple', 'bat', 'carrot', 'dog'] result = { [1]: [2] for word in words if len(word) [3] 3 } print(result)
The dictionary comprehension uses word.upper() as keys, len(word) as values, and filters words longer than 3 with >.