在猜谜游戏中,我希望count是guesses的数量变量,当您赢得游戏时,它会打印值。每当我试图在else部分下添加count=count+1行代码时,我总是得到大量错误。在import random
from random import randint
secret = randint(0,11)
count = 1
def guessing():
print ("Guessing easy: The secret number will stay the same every turn")
guess = int(input("Guess a number from 1 to 10 "))
if secret == guess:
print ("Your guess was", guess)
print ("Well done, you win")
print ("It took you", count, "guessing to win")
startgame()
else:
print ("Your guess was",guess)
print ("Sorry, your guess was wrong. Please try again""\n")
guessing()
def guessinghard():
print ("Guessing hard: The secret number will change every turn")
secret = randint(0,11)