guess = input("H or T?")

def game():
    num_rounds()
    for p1 in range(0, 2):
        p1 = ("H", "T")
        p2 = random.choice(p1)
        guess1 = input("What was your pick?")

    for p1 in p2:
         if p1 == guess1:
            print("I win this round!")
         if p1 != guess1:
            print('You win this round!')
    for p1 in range(0, 8):
        p1 = ("H", "T")
        p2 = random.choice(p1)
        guess1 = input("What was your pick?")
    for p1 in p2:
        if p1 == guess1:
            print("I win this round!")
        elif p1 != guess1:
            print('You win this round!')

    print("Thanks for playing!")
    quit()


回合= 10
   对于范围内的回合(回合):
      打印(“圆形”,圆形)
      游戏()

我希望它打印出来:

Round 1: Choose H or T.


在开始游戏之前

最佳答案

定义回合,然后使用range()表示时间,并使用for循环重复进行所需的回合。实际上是下次尝试。

关于python - 似乎无法打印出“第一轮,第二轮,外部”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43708840/

10-13 07:22