Skip to main content

Character and String

Character refers to a sign humans use to represent letters, numbers, and other symbols.

A, B, 1 are all characters.

In Python, if you surround whatever symbol with '' or "", it is a string.

Saving string data

All strings have to be inside of quotes.

1 is not a string because it is not surrounded by quotes.

Note that strings inside the quotation marks should be in one-line.

The example below shows us an error when the strings are on a seperate line.

The variable a is correctly formatted and saved while the variable b is not.

Multi Line String

To use multi-line syntax, there are multiple ways to achieve this.

  1. Simply use multiple print() statement
  2. Use the escape character \n (Escape Character) to create a new line.
  3. Use triple quotes