Python 编写程序,生成1000个随机[20,121)之间的整数,并统计每个元素出现的次数
练习题
2018.10.11
import random
a = [random.randint(20,121) for i in range(1000)]
y = set(a)
for i in y:
print (i," ",y.count(i))
Python 编写程序,生成1000个随机[20,121)之间的整数,并统计每个元素出现的次数
练习题
2018.10.11
import random
a = [random.randint(20,121) for i in range(1000)]
y = set(a)
for i in y:
print (i," ",y.count(i))