Write a Python program that uses the random module to generate a list of 10 random numbers between 0 and 50. Return the list of numbers.
Example:
This will depend on the random numbers generated.
The random module in Python has a function randint() which generates a random number within the provided range. You can use a list comprehension to generate 10 random numbers.
import random
def generate_random_numbers():
return [random.randint(0, 50) for _ in range(10)]
print(generate_random_numbers())
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.