Answer:
follows are the correct python code to this question:
import random as r#import random package as r
import statistics as s #import statistics package as s
l= r.sample(range(0,12),10)#defining l variable that use random function to store 10 random numbers
avg= s.mean(l)#defining avg variable for calculate average of l
print('List of random number are: ', l)#print list of random numbers
print("The random number Average is: ", avg)#print average value
Output:
List of random number are: [4, 10, 6, 0, 3, 5, 1, 7, 11, 2]
The random number Average is: 4.9
Explanation:
In question 1:
In the given code, two packages are imported, which are "random and statistics", in which "random" is used to generate a random number, and "statistics" is used to calculate the average value.
In the code, the "l" variable is used, which uses a random function and store 10 random numbers, and an "avg" variable is defined that calculates the average value. In the last step, the print method is used that print number and its average value.
In question 2:
The given code is wrong because it only calls the "random" method, which is not defined.