Complete the code to generate a single random number between 0 and 1 using numpy.
import numpy as np random_number = np.random.[1]()
The np.random.random() function generates a random float between 0 and 1.
Complete the code to generate an array of 5 random floats between 0 and 1.
import numpy as np random_array = np.random.[1](5)
np.random.random(5) creates an array of 5 random floats between 0 and 1.
Fix the error in the code to generate a 2x3 array of random floats between 0 and 1.
import numpy as np random_matrix = np.random.random([1])
The shape argument must be passed as a tuple inside parentheses: random(2, 3) is incorrect, it should be random((2, 3)).
Fill both blanks to create a dictionary with words as keys and their random scores between 0 and 1 as values.
import numpy as np words = ['apple', 'banana', 'cherry'] scores = {word: np.random.[1]() for word in [2]
Use np.random.random() to generate random floats and iterate over the list words to create the dictionary.
Fill all three blanks to create a dictionary with uppercase words as keys and random scores greater than 0.5 as values.
import numpy as np words = ['dog', 'cat', 'bird'] result = {word.[1](): np.random.random() for word in words if np.random.random() [2] 0.5 and word [3] 'cat'}
Use word.upper() to make keys uppercase, select random values greater than 0.5, and exclude the word 'cat' using !=.