标签:number mat ted sorted print bsp int rand 奇数
1 random_numbers = [] 2 for i in range(40): 3 random_numbers.append(random.randint(1, 100)) 4 num1 = [] 5 num2 = [] 6 for number in random_numbers: 7 if number % 2 == 0: 8 num1.append(number) 9 else: 10 num2.append(number) 11 12 print(‘偶数:{}‘.format(sorted(num1))) 13 print(‘奇数:{}‘.format(sorted(num2))) 14 print(‘列表:{},长度:{}‘.format(sorted(random_numbers), len(random_numbers)))
标签:number mat ted sorted print bsp int rand 奇数
原文地址:https://www.cnblogs.com/yuchenlove/p/8794583.html