我收到以下錯誤,當我嘗試執行這段代碼,下面的線的Python 3 - EOF錯誤
Traceback (most recent call last):
File "c:\dev\tmp\_t636427523447579562.py", line 32, in tentativa = int(input())
EOFError: EOF when reading a line
import random
import sys
controlo = 0
numero = 134+78
while controlo<3:
tentativa = int(input())
if tentativa == numero:
print("Acertou")
break
else:
controlo +=1
continue
if controlo == 3:
print("Falhou")
sys.exit()
controlo = 0
random_1 = random.randrange(1, 100)
random_2 = random.randrange(1, 100)
soma = random_1 + random_2
while controlo<3:
tentativa_2 = int(input())
if tentativa_2 == soma:
print("Acertou")
break
else:
controlo +=1
continue
if controlo == 3:
print("Falhou")
似乎適合我。也許試着在你的代碼末尾加上''controlo + = 1,continue''的縮進代碼 –