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 Meet Python Variables

Hello, when I type a code print('Hello',', first_name) as in the video I get an error in the console syntax is invalid

SyntaxError: EOL while scanning string literal points to first_name.... also I am not able to take screen shots of the workspace. Screenshots always empty

Hi I think you have a trailing apostrophe and comma there. Should read as follows:

print('Hello', first_name)

The string followed by the variable reference.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

When Python sees a single or double quotation mark while parsing a line of code, it continues to scan to find the matching closing mark.

print('Hello',', first_name)
      ^ start of first string
            ^ end of first string
              ^ start of second string

The parser thinks the second string is “, first_name)” but cannot find the closing single quotation mark which raises the syntax error. The automatic color highlighting shows the runaway string.