![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
随机数
文章平均质量分 71
程序猿少年郎
这个作者很懒,什么都没留下…
展开
-
python猜数字游戏
#引入随机数包import random'''1.生成一个随机答案数2.输入要猜的数字3.对比猜的数字和正确答案 3.1猜大了 3.2猜小了 3.3猜对了 3.3.1继续玩 3.3.2退出'''number = random.randint(0,100)#声明变量用来表示用户猜测的次数count = 0a = 10while...原创 2018-07-10 15:00:27 · 5999 阅读 · 0 评论 -
python随机数产生100个整数(0-100),统计出现次数最多的数字.
import random# 随机数产生100个整数(0-100),放入一个列表中,统计出现次数最多的数字.# 1.存放随机数列表number = []# 2.循环100次for i in range(0,100): # 3.生成随机数 num = random.randint(0,100) # 4.添加到列表中 number.append(num)pr...原创 2018-07-10 15:01:25 · 73564 阅读 · 4 评论