End Of File error after putting .input() (Games of Chance)

Hi i was trying to create a flip & coin game also trying to understand concepts better unfortunately it seems I can’t use input I tried to research in google a bit but no luck for me :frowning: Could you help me ?

import random

money = 100

Heads = 1
Tails = 0
Question = input("Heads Or Tails ?")
Wager = input("Your Bet ?")

def flip():
  result = random.randint(Tails, Heads)
  if Question == result:
    money += int(wager)
    return "Congrats You Won {} Bucks !!!".format(wager)
  else:
    money -= int(wager)
    return "How Unfortunate, You Lost {} Bucks !!!".format(wager)


print(flip())
  

Hi!

What’s your error msg? Are you running it on the console? Are you running it on python3?

I’am running on the codeacademy challenge its weird because when i paste it on the Atom, problem is solved

Question = int(input(“Heads Or Tails ? :”))
EOFError: Eof when reading a line

There are number of lessons where the input functions are diabled/broken and will always throw an error (perhaps it’d be best just to work through it without them for now). Seems the editor isn’t configured to accept input (whether by intention or not I do not know).

2 Likes

Usually it’s best to run code that calls for input from your own terminal first (in my experience at least). This is what I get when I run your code. Notice the error will still need to be dealt with. But in principle the input works.

1 Like

Indeed, and the Games of Chance Challenge Project appears to be one of them. :slight_smile:

2 Likes