import random arr = [] while True: number = random.randint(0,9) varbool = number in arr if varbool == False: arr.append(number) if len(arr) == 10: print(arr) print(sorted(arr)) input()