📚
Quote Styles
Three Ways to Write Strings
Python gives you multiple ways to create strings, and each has its purpose:
Single quotes — the simplest form:
message = 'Hello, World!'
Double quotes — useful when your text contains an apostrophe:
message = "I'm learning Python" # Apostrophe inside double quotes # message = 'I'm learning Python' # ❌ This would crash!
Triple quotes — for text that spans multiple lines:
poem = """Roses are red, Violets are blue, Python is awesome, And so are you."""
Single and double quotes are interchangeable — use whichever avoids conflicts with the text inside.
💡💡 Rule of thumb: Use double quotes by default. Switch to single quotes if your text contains double quotes, or use triple quotes for multi-line text.
main.pySandbox
main.py
Ctrl + Enter