View Full Version : Random array
Is there any way I can create an array of
Continuous random sort it
thank all !!
You can use one of the functions from Python's random module to generate random numbers and place those in a list. Lists have a sort method you can use to sort the elements within.
import random
numbers = []
for i in range(1,10):
number = random.randint(1,10)
numbers.append(number)
print numbers
numbers.sort()
print numbers
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.