Complete the code to import the module needed for random data generation.
import [1]
The random module is used to generate random numbers and data in Python.
Complete the code to generate a random integer between 1 and 10.
num = random.[1](1, 10)
The randint(a, b) function returns a random integer N such that a <= N <= b.
Fix the error in the code to select a random element from the list.
item = random.[1](items)The choice() function returns a random element from a non-empty sequence like a list.
Fill both blanks to create a list of 5 random integers between 1 and 20.
numbers = [random.[1](1, 20) for [2] in range(5)]
Use randint to get random integers including both ends. The variable i is a common loop variable name.
Fill all three blanks to create a dictionary with words as keys and their lengths as values, only for words longer than 3 letters.
lengths = {word: [1] for word in words if len(word) [2] 3 and word.[3]('a')}This dictionary comprehension maps each word to its length if the word is longer than 3 letters and starts with 'a'.