Strings are a really commonly used type in Python, and can be formed simply by placing quotes around characters. Anything that resides inside of quotations is a string (single quotes or double quotes are both acceptable). To create a string, you simply need to assign these characters inside quotes as values to a variable, like this:
var = "I'm a string!"
Printing a string is equally as easy as creating one. When you print something, you’re basically defining an output. You can print any string you want like this:
print “I’m a string too”
The output for the line of code above would simply be, “I’m a string too”. As you can probably tell, printing is pretty straightforward. You can also print a predefined string or value by printing a variable, like this:
As you saw above, var is already defined, so the output for the line of code above would be, “I’m a string!”