我需要编写代码,将模拟100投币和efter,告诉我们有多少尾巴和头部,我们下降。我做错什么了?你知道吗
import random
orzel = 0
reszka = 0
suma = orzel + reszka
while suma != 100:
rzut = random.randint(1,6)
if rzut == 1:
orzel +=1
if rzut == 2:
reszka +=1
print(orzel, "i", reszka)
input("koniec")
Tags:
您可以通过使用
random.randint(1,2)
并在循环内移动suma = orzel + reszka
来修复代码,但最好使用类似这样的python方法:相关问题 更多 >
编程相关推荐