Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPhillip Shakesby
1,009 PointsI am struggling to work out what's wrong with this python variable
name = input("What's your name? ")
if name == "Phillip":
print(name + " is cool ")
else:
print (name + " is a dork and " + name + " smells funny! ")
Phillip Shakesby
1,009 PointsOn one of the code challenges = Phython Basics-Create a variable named name with your name in it.
I keep getting the error
Bummer! EOFError: EOF when reading a line
2 Answers
Gard Mikael Fjeldavli
19,416 PointsYou might be running Python 2. In Python 2, raw_input() returns a string, and input() tries to run the input as a Python expression. Try switching your input command with the raw_input command. Like this:
name = raw_input("What's your name? ")
if name == "Phillip":
print(name + " is cool ")
else:
print (name + " is a dork and " + name + " smells funny! ")
Phillip Shakesby
1,009 PointsOn one of the code challenges = Phython Basics-Create a variable named name with your name in it.
I keep getting the error
Bummer! EOFError: EOF when reading a line
Phillip Shakesby
1,009 PointsOn one of the code challenges = Phython Basics-Create a variable named name with your name in it.
I keep getting the error
Bummer! EOFError: EOF when reading a line
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsHi Phillip,
I just tested your code and it worked fine, what is the error you're getting (if any)?