Strings and Things

Something we’ll be making extensive use of today is something called a string. A string, is simply a piece of text, that is denoted by quotation marks. You can make a string in the exact same way that you make any other variable, but they behave differently than the variables we’ve seen so far. Lets take a peek at an example.

Lets say you declare a variable, named food, and you set it to a string that represents your favorite food, like follows:

food = "Chicken and Waffles"

If you use the plus sign with strings, you can smash two strings into one, so adding the following to the code we have…

sentence = "My favorite food is " + food
print(sentence)

…Will print out the full sentence “My favorite food is Chicken and Waffles”.