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

How can I make the answer to an input question a variable?

input("Hello, what is your first name?") print("Hello,", first_name)

first_name is what I want the name of the variable to be. I found out through trial and error that I cannot simply replace the first line with: first_name = input("Hello, what is your first name?")

1 Answer

Steven Parker
Steven Parker
243,228 Points

What problem do you have when you make that assignment? That seems correct.

What I'm trying to do is when after the first name is typed it greets you saying "Hello, person's first name. I just retyped the code and now it works smoothly. Before I was getting a syntax error. Thanks for your response.