Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint, shuffle
- from time import sleep
- # RETURNS a sorted list
- def rand_sort(inp):
- l = list(inp)
- cop = list(l)
- cop.sort()
- while l != cop:
- shuffle(l)
- print l
- return l
- # RETURNS a list of integers from 1 to the argument
- def gen_list(length):
- l = []
- full = False
- while full == False:
- r = randint(1,length)
- if r not in l:
- l.append(r)
- if len(l) == length:
- full = True
- l.sort()
- return l
Advertisement
Add Comment
Please, Sign In to add comment