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 trialJessica Brown
228 PointsChallenge task 1 of 1- Create a variable
I have tried everything I can think of to write this code right, and I am obviously doing something wrong. How do I make a variable named name, and then assign the variable to my own name?
name = Jessica
print("Jessica")
2 Answers
James Auger
565 PointsThis is because you're printing off a variable that hasn't been set, nothing has been set to the variable named Jessica. If you want to display "Jessica", pass the variable you have set. This variable is called name, Jessica is data not a variable. Full example: name = "Jessica" print(name)
James Auger
565 PointsYou can assign a variable as a string by using quotation marks between Jessica, for example: name = "Jessica" then you can print it off as a string by typing in the variable in the print function with no quotation marks
print(name)
Jessica Brown
228 PointsThank you for responding to my question. I have tried that too and for some reason it won't take it. This is what I have:
name = "Jessica"
print(Jessica)
It still says it can't find my variable :(
Jessica Brown
228 PointsJessica Brown
228 PointsThank you so much. I totally get it now :)