Why is this code from the Games of Chance ‘Heads or Tails’:
def flipping_coin(): bet = input('How much are you betting? ') outcome = input('Heads of tails? ') outcome.lower() bet = int(bet) coin = round(random.randint(1, 2)) if coin == 1 and outcome == 'heads': print('You won! You won this much ' + str(bet) + ' congratulations!') money += bet return money elif coin == 2 and outcome == 'tails': print('You won! You won this much %d congratulations!') % (bet) money += bet return money else: print('You lost! You lost this much ' + str(bet) + ' bad luck!') money -= bet return money flipping_coin()
throwing this error:
Traceback (most recent call last): File "script.py", line 24, in <module> flipping_coin() File "script.py", line 7, in flipping_coin bet = input('How much are you betting? ') EOFError: EOF when reading a line
I have tried putting the
input() for both
outcome outside the function. It threw the same error.
Thank you sincerely!