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 trialRobert Johnson
2,245 PointsI keep getting an EOF error on Python
This is the code that I am using:
name = input("What is your name? ")
if name == "Rob":
print(name + "is awesome!")
else:
print(name + "isn't awesome!")
--> Please let me know if you find any flaw in this
nvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsI think he does not.
Robert Johnson
2,245 PointsNo I did not - I am planning on going through all of the videos again so I can see if I am just misunderstanding something and if I still have an issue I will let you know. Thank you.
4 Answers
Miguel de Luis Espinosa
41,279 PointsI'm not an expert, but it seems like you are not indenting your code well
try
name = input("What is your name? ")
if name == "Rob":
print(name + " is awesome!")
else:
print(name + " isn't awesome!")
nvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsIt may be because you use Python 2 version. In here, we use Python 3. Try the code below.
name = raw_input("What is your name? ")
if name == "Rob":
print(name + " is awesome!")
else:
print(name + " isn't awesome!")
I hope it helps
Robert Johnson
2,245 PointsJust to give context I am using this for the code challenge on the "ins & outs" section of the Python Basics Course and when I copied and pasted your code it says: "Bummer! NameError: name 'raw_input' is not defined"
nvcxnvkldsjaklfds
Courses Plus Student 5,041 Pointsthen try this
name = input("What is your name? ")
if name == "Rob":
print(name + " is awesome!")
else:
print(name + " isn't awesome!")
Robert Johnson
2,245 PointsThank you for the quick response. I tried it but still wouldn't work for me. I even tried copying and pasting what I did in Workspaces because it worked there but that didn't do me any good either.
Ryan Carson
23,287 PointsHi Robert,
This might be a problem with the Code Challenge Engine unfortunately. Hopefully not, but in case, I'm copying in a dev from the Education Team, Kyle Meyer
Sorry for the trouble!
Ryan
Miguel de Luis Espinosa
41,279 PointsOdd, because it did work (and does work) in my workspace
Have you remembered to save your file? If all fails try making a new file or open a new workspace
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherRobert Johnson Did you ever get this fixed?