Here is some empirical data: { 1, 2, 1, 4, 5, 3, 1, 2, 2, 1, 1, 3, 5, 1, 3, 2, 1, 2, 5, 2, 4, }. Create a Python program that draws a random number from the empirical distribution of this data
Answer:
import random
numberList = [1, 2, 1, 4, 5, 3, 1, 2, 2, 1, 1, 3, 5, 1, 3, 2, 1,
2, 5, 2, 4]
print("random number from list is: ",
random.choice(numberList))
Explanation:
In this program we first import the library random. Then we create the list named as numberList with numbers. At last print random number from random.choice(numberList).
Hope you like the
answer.
Get Answers For Free
Most questions answered within 1 hours.