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 trialJohn Morris
4,752 PointsVariable
I think I am describing the variables right, but for some reason it is not working.
print("Hello")
print (name)
name = 'jeff'
print("Let's do some math!")
print(5 + a)
a = '21'
print("Thanks for playing along!")
3 Answers
Jeremy Hill
29,567 PointsYou have to initialize the variable before you can use it; put the lines with the equals signs before the corresponding print lines. This is what you have:
print (name)
name = 'jeff'
print("Let's do some math!")
print(5 + a)
a = '21'
This what it needs to look like:
name = 'jeff'
print (name)
print("Let's do some math!")
a = '21'
print(5 + a)
John Morris
4,752 Pointsthanks a ton
Jeremy Hill
29,567 PointsYou're welcome :)
Jeremy Hill
29,567 PointsJeremy Hill
29,567 Pointsbut your output will look something like this:
jeff
Let's do some math!
521
Edited*
I believe your last print line will throw an error, fyi.
If you need help fixing it let me know.