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 seem to understand where exactly is the SyntaxError

I introduced a name before calling in the "print" command, tried to fix in the errors by changing the string to a variable, and changed the quote at the end of the last statement.

errors.py
print("Hello")
print(name)
    name='Vijayashree'
    print(name)

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

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

3 Answers

Jakob Hansen
Jakob Hansen
13,746 Points

Indentation and using undeclared variables is the problem.

print(name)
    name='Vijayashree'
    print(name)

should look like this

print(name)
name='Vijayashree'
print(name)

another thing is that you're trying use the variable name, on line 2 in the print(name), before having declared it on line 3.

You're indenting the print("5"+"5") again, which doesn't work. Indentation matters in Python :)

and finally in the second last print statement, you have mixed " and ยด if you open a string with a quatotion mark (") it needs to end with a quotation mark as well :) You can't open with a (") and close it with a (ยด)

Sorry my code got cut off. Change

print(name) to print("name")

You don't need to add anything. Just fix the errors in the code. For example:

should be changed to:
```print("name")```