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 (2015) Python for Beginners Correct errors

How do I complete the Code Challenge: Correct errors on Learning the Basics of Python.

Ok so I need help for this Code Challenge, and I simply can't get it correct. Here is a screen shot of it. Thank you for helping.

errors.py
print("Hello")
print(name)

print("Let's do some math!")
print(5 + "a")

print("Thanks for playing along!')

2 Answers

first off the variable name is not defined so the print(name) will error, you need to define the name variable, I would suggest doing name = 'yourname'.

second, you cannot add a string and a number, that's why 5 + 'a' will not work, you can fix this by changing 5 from a number into a string by adding quotation marks around it, so you'll get '5' + 'a'

lastly, the last print statement says "Thanks for playing along' it starts with a double quote " and ends with a single quote ', this will not work since you need to use the same quote on a single string, you need to change one of those quotation marks so that it will match the other

That should be it

Thank you so much!!!