コードを試すたびに機能しますが、入力する'stop'
とエラーが発生します。
ValueError: 基数 10 の int() の無効なリテラル: 'stop'
def guessingGame():
global randomNum
guessTry = 3
while True:
guess = input('Guess a Number between 1 - 10, You have 3 Tries, or Enter Stop: ')
if int(guess) == randomNum:
print('Correct')
break
if int(guess) < randomNum:
print('Too Low')
guessTry = guessTry - 1
print('You have, ' + str(guessTry) + ' Guesses Left')
if int(guess) > randomNum:
print('Too High')
guessTry = guessTry - 1
print('You have, ' + str(guessTry) + ' Guesses Left')
if guessTry == 0:
print('You have no more tries')
return
if str(guess) == 'stop' or str(guess) == 'Stop':
break