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

i know that it is a syntaxerror but i dont know what to do to solve it?

print("hello") print("name")

so it should print the string hello and it should print the string name

print ("lets do some math!")

it should print the string lets do some math!

print ("5+"a")

ok here it gets weird, i have a function that has a integer and a string or a variabel that is called a? but i have no variabel and also i dont know if i can put a integer and variabel inside a function like that plz help :)

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

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

print("Thanks for playing along!")

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Oh wow, you're close on this one. In fact, you're off by just one character. There are two ways to solve this particular error. Python does not allow for strings and integers to be added together implicitly. That is to say that the two data types being added should either both be numbers (addition) or strings (concatenation). So here you have a choice. You can either leave the 5 as is and change "a" to any integer `

print(5 + 20)

Or, you can change the 5 to a string, and keep the "a" as is (and this is the route you were headed):

print("5" + "a")

Your solution was only missing the closing quotes after the "5.

Hope this helps! :sparkles:

thank you so much, jennifer nordell.