digit= open('pi.txt','r')
guess = digit.readline()
while guess.isdigit():
if digit == ".":
digit = pi.read(1)
elif digit == "\n":
seed += 1
pi.seek(seed)
digit = pi.read(1)
else:
if int(guess) == int(digit):
print(guess, "is correct")
correct += 1
else:
print("Sorry, number is", digit, "not", guess)
wrong += 1
guess = input("enter another digit guess or \"q\": ")
digit = pi.read(1)
print("\nThanks for playing\nNumber Correct:", correct, "\nNumber Incorrect:", wrong)
pi.close()
ВЫХОД:
Thanks for playing
Number Correct: 0
Number Incorrect: 0
Нужно понять, как добавить числа для правильных и неправильных чисел, и я понятия не имею, что делать.