Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Single quoted and double quoted strings

In Python, just as in most of the programming languages you must put any free text inside a pair of quote characters. Otherwise Python will try to find meaning in the text.

These pieces of texts are called "strings".

In Python you can put string between two single quotes: '' or between two double quotes: "". Which one, does not matter.

soup = "Spiced carrot & lentil soup"
salad = 'Ceasar salad'

print(soup)
print(salad)
Spiced carrot & lentil soup
Ceasar salad