1 Star 1 Fork 0

lavenliu/MyPy3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
six_die.py 755 Bytes
一键复制 编辑 原始数据 按行查看 历史
lavenliu 提交于 2020-09-09 17:53 . first add
import random
frequency1 = 0
frequency2 = 0
frequency3 = 0
frequency4 = 0
frequency5 = 0
frequency6 = 0
for roll in range(1, 6001):
face = random.randrange(1, 7)
if face == 1:
frequency1 += 1
elif face == 2:
frequency2 += 1
elif face == 3:
frequency3 += 1
elif face == 4:
frequency4 += 1
elif face == 5:
frequency5 += 1
elif face == 6:
frequency6 += 1
else:
print('never get here!')
print("face {:>13}".format("Frequency"))
print(" 1 {:>13}".format(frequency1))
print(" 2 {:>13}".format(frequency2))
print(" 3 {:>13}".format(frequency3))
print(" 4 {:>13}".format(frequency4))
print(" 5 {:>13}".format(frequency5))
print(" 6 {:>13}".format(frequency6))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/lavenliu/my-py3.git
git@gitee.com:lavenliu/my-py3.git
lavenliu
my-py3
MyPy3
main

搜索帮助