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 Python Basics (Retired) Ins & Outs Ins & Outs

Create a variable named name with your name in it. please help i cant get any solution ?

Code i am using to create a name Variable

name = input("whats your name") if name == "gladdy": print(name + "is my name ") else: print(name + "is not my name")

I am getting an EOF Error not sure what not working

name.py
name = input("whats your name")
if name == "gladdy":
    print(name + "is my name ")
else:
    print(name + "is not my name")  

4 Answers

I ran your script through IDLE, and it seemed to work fine. Although what it could be is that on the 3d and 5th line, you have your code presented like this: print(name + "is my name ") which would output "Gladdyis my name." and print(name + "is not my name") which would output "Gladdyis not my name."

Try fixing the two lines like so- print(name + " is my name." and print(name + " is my name.") ^ Notice the space. The lack of a space between the first parentheses and the first word is adding the "name" function to that word. So it turns out like this: "Gladdyis" instead of what it needs to be: "Gladdy is"

TL:DR The lack of a space between your first parentheses and first word on lines 3 and 5 might be the issue.

So your final code would look like this-

name = input("whats your name") if name == "gladdy": print(name + " is my name ") else: print(name + " is not my name")

-Ethan (Sorry about the formatting, the site messed it up.)

Hi Ethan,

Thanks for the quick reply but after formatiing the code as well i am getting the same error. looks like something is wrong with the code editor as it just keeps giving errors

Hi Ethan,

You are right the code seems to be working but i cannot understand the question i think - do you what this quiz is - the task is to Create a variable named name with your name in it?

Any thoughts

Thanks for your time and for helping me

Regards Gladdy

Well... Figured it out. Its pretty simple, but its worded strange. The question is simply asking for you to create a variable called "Name" with your name in it. So all you have to do, is this: name = 'Gladdy' Pretty simple? Yup. Its just a tad confusing, that's all.

Had the same issue. You must create name as a variable so the code should be: name = "your name"

What I don't understand is that we never learned that in the previous lessons. I am still stuck on this specific lesson with no solution provided.

Hi Colin,

Were do i need to add that Code is it - name = input ("whats your name ") or do i add it - if name == "gladdy"

so where do i need to add the code that you gave - name="your name"

Regards, Gladdy

It's just the code name = "Gladston"

You don't implement anything you learned from the last video. I don't know why, but that's how it is.

The only thing you need is the code I provided from above, nothing else. Just the one line.

Also if my answer is correct make sure you get back to me or highlight my answer as right in order for others on the forums to find solutions quicker.

Colin Forrest

Hi Colin ,

I will definitely mark your answer, if its working for me, but still i dont get it. sorry but i am new to programing so it take a little more time for me to understand. I will try what you have mentioned.

Regards Gladdy

I am also very new to programming as well and I totally understand. Takes a bit of time and forum surfing for me to understand it as well.

Colin

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

We definitely created variables in previous lessons, Colin Forrest.

You'll never need to use input() in a code challenge.

Kenneth Love I do apologize I did go back and realized my mistake. By the way I'm really enjoying your tutorial. This is the first ever tutorial on coding I've received. I guess "A Hour of Code" got me interested and made me want to learn more about programming and such. The only problem is I'm a student at a boarding school and I only posses an IPad, so the only thing I can use is the environment inside the Treehouse app. Is there anything I can use to make my own projects on the IPad?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

On the iPad, I don't think so. With the iPad, definitely. If you have a server somewhere that has Python installed (say, Digital Ocean or probably even Heroku) and you get an SSH app for the iPad, you should be able to create and edit files on that server, likely using something like Emacs or Vim. Or, if that scares you as much as it should (I love both of those editors but can't imagine using them on an iPad), there's probably an app or two out there that lets you edit remote files in a nice text editor. Again, use that with a Python-friendly server and you should be good-to-go.