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 Syntax and Errors

I thought that was becouse the " ' becouse i thaught that a string need to be inside " ". is that right?

The question showed that the statement print is ("Hello, World')

But my doubt is that possible to put a string between " and '. because I thought it needed to be used with the same punctuation and in c ++ when you put the word between 'T' it means a character.

1 Answer

Martynas Matimaitis
Martynas Matimaitis
10,480 Points

Hey,

in Python a string can be defined both by single quotes (') and double quotes (") main thing is consistency when assigning it. So both of these would work:

string1 = "string"
string2 = 'string'

But when trying using different quotes for the same string you will get a syntax error.

Hope this helps!