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 don't get it, I don't know what to do :c

Can someone help me, I feel like I'm lost...

errors.py
print("Hello")
print("World!")

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

print("Thanks for playing along!')

1 Answer

nicole lumpkin
PLUS
nicole lumpkin
Courses Plus Student 5,328 Points

Hey Elshaarawi! First I would reset the challenge to restore to the default values. Let's break this down line by line.

print("Hello")

There is nothing wrong with this line so leave it as is.

print(name)

This would raise an exception(error) because name is not defined. You can either turn it into a string by surrounding it with quotes, or you can define name on a line previous to the print statement

# option 1
name = 'nicole'
print(name)

#option2
print('name')

next line

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

There are no errors in the first line, however in the second line you cannot add and integer with a string, so you should convert 5 to a string.

print('5'+ 'a')

And finally, the use of double and single quotes is problematic in Python. You may define a single string with one or the other but not both.

print("Thanks for playing along!')
#option1
print("Thanks for playing along!")

#option2
print('Thanks for playing along!')