String

noun

say it: “string” /strɪŋ/

Text in a program, such as letters, numbers, spaces or symbols, written inside single or double quotes.

What is a string in Python?

A string is text: letters, numbers, spaces or symbols inside quotes. Single or double quotes both work.

greeting = "Hello"
item = 'coffee'
print(greeting, item)  # Hello coffee

In a sentence

  • “"Hello" is a string, and so is '42' because it's in quotes.”
  • “input() always gives back a string, even when the user types a number.”

Level: Novice · More Python terms at this level

Updated

In other subjects