import random arr = [] while True: number = random.randint(0,9) sign = random.randint(0,1) if sign == 0: arr.append(number) if sign == 1: arr.append(-number) if len(arr) == 10: print(arr) input()