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

1st Python Challenge

This one is giving me trouble. I created the variable but the math part is giving me trouble. I don't know where to begin.

name = "Edwin" print("Hello") print(name)

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

print("Thanks for playing along!")

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

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

print("Thanks for playing along!")

2 Answers

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

Hi there! It seems to me that you're doing fairly well so far. But keep in mind that while some languages can add an integer and a string together, Python is not among them.

So you have this line:

print(5 + "a")

And here you have two options. You can either change both to be a string, or both to be a number.

print(5 + 2)

would work as well as:

print("z" + "a")

Hope this helps! :sparkles:

rakan omar
rakan omar
15,066 Points

adding integer and string is not compatible.

print(str(5) + "a")

this will turn integer 5 into string '5'