In computer science, sequences of characters are referred to as strings. Strings can be any length and can include any character such as:

  • Letters
  • Numbers
  • Symbols
  • Whitespace (spaces, tabs, new lines)

It is usually contained within a pair of 'single quotes' or "double quotes".

A string can be thought of as a list of characters. Like any other list, each character in a string has an index.


Here are some examples of strings:

message = "Hello, world!"
username = "@sonnynomnom"
old_password = "Tr0ub4dor&3"
new_password = "correcthorsebatterystaple"
Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn More on Codecademy