Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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")```