Printing 我的代码无法打印

Printing 我的代码无法打印,printing,Printing,我不知道为什么不打印正面和反面的数字,我做的每件事都是一样的。没有什么 有人能帮忙吗?这是昨天到期的评估的一部分 import random heads = 0 tails = 0 rounds = 0 while rounds < 100: coin = random.randint(1, 2) if coin == 1: heads += 1 rounds += 1 elif coin == 2: tails += 1 rounds += 1 print("You Flip

我不知道为什么不打印正面和反面的数字,我做的每件事都是一样的。没有什么 有人能帮忙吗?这是昨天到期的评估的一部分

import random

heads = 0
tails = 0
rounds = 0

while rounds < 100:
coin = random.randint(1, 2)

if coin == 1:
heads += 1
rounds += 1

 elif coin == 2:
tails += 1
rounds += 1

print("You Flipped Heads {} Times!".format(heads))
print("You Flipped Tails {} Times!".format(tails))
随机导入
人头=0
尾部=0
轮数=0
当轮数小于100时:
硬币=random.randint(1,2)
如果硬币=1:
人头数+=1
回合数+=1
elif硬币==2:
尾部+=1
回合数+=1
打印(“您翻转了头{}次!”。格式(头))
打印(“你翻转了{}次尾巴!”。格式(尾巴))

可能损坏的缩进导致while循环无限循环:)

import random

heads = 0
tails = 0
rounds = 0

while rounds < 100:
  coin = random.randint(1, 2)

  if coin == 1:
    heads += 1
    rounds += 1

  elif coin == 2:
    tails += 1
    rounds += 1

print("You Flipped Heads {} Times!".format(heads))
print("You Flipped Tails {} Times!".format(tails))
随机导入
人头=0
尾部=0
轮数=0
当轮数小于100时:
硬币=random.randint(1,2)
如果硬币=1:
人头数+=1
回合数+=1
elif硬币==2:
尾部+=1
回合数+=1
打印(“您翻转了头{}次!”。格式(头))
打印(“你翻转了{}次尾巴!”。格式(尾巴))

这是一个工作模式。

请修复代码的缩进;在上面贴上蟒蛇家族的标签你救了我的分数!