import random n=int(input()) inputArray=[] for i in range (n): r=random.randint(1,1000) inputArray.append(r) inputArray=list(set(inputArray)) #先生成集合,然后转换为数组,去重的作用 inputArray.sort() #排序 OutputArray=inputArray for i in OutputArray: print(i) 结果: 9 56 200 271 444 595 672 679 836 907
转载于:https://www.cnblogs.com/hehedaaa/p/8909818.html
最后
以上就是仁爱战斗机最近收集整理的关于产生随机数去重排序的全部内容,更多相关产生随机数去重排序内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复