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 trial

Python

i need to Create a variable named name with your name in it. this is the code i am using but keep getting this error -

I keep getting this EOFError EOF when reading a line

my Code is

name = input(" what is your name? ")

if name == "kenneth": print("{} is a lumberjack ".format(name)) else: print(" {} works all day and night ".format(name))

You need to format your question, put three back ticks before and after your code ```.

Double check that your indentation is correct.

Hey Paul,

Thanks for the quick reply- i checked my indentation its correct, i added the ticks as mentioned still i am getting the same results.

4 Answers

have you tried raw_input?

name = raw_input("What is your name?  ")

will return the string entered in speech marks

input seems to only return if the user enters their name in speech marks or enters a number

also indentation should look like this i reckon

if xxxxx  :
    print xxxxx
else xxxxx:
    print xxxxx

Hi Geroge,

this is what i see in preview - name = if name == 'main': main()

i have tried it but it keep giving me syntax error, not sure what i am doing wrong here

any help would be great.

Thanks Gladdy

Hi Gladdy, I'm sorry I don't know why. Can you repost the whole code like this with 3 back speech mark things ? It's written in the "Markdown Cheatsheet"

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Where are you getting this error? When you run the code in Workspaces/on your computer, or as the answer to a code challenge? If it's the latter, you don't ever need to use input() in a code challenge.