Ajax-loader-large-white
Strings & Console Output
Strings

Another useful data type is the string. A string can contain letters, numbers, and symbols.

name = "Ryan"
age = "19"
food = "cheese"
  1. In the above example, we create a variable name and set it to the string value "Ryan".
  2. We also set age to "19" and food to "cheese".

Strings need to be within quotes.

Instructions

Create a new variable brian and assign it the string "Hello life!".

?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Do you remember how to declare and assign variables in Python? If not, refresh your memory here!

There is no difference between using single quotes ' and double quotes ". However, sometimes it is helpful to use one or the other. If we want to include an apostrophe in our string, it would be smart to use double quotes to create the string like "I'm a string". If we want to use quotes in the string, we might want to create the string with single quote like 'The man screamed "I love Python!" so that everyone could hear.'

script.py