What is a String?
In one of the first chapters, you learned how to make the Python output message "Hello, Python!"
. This message is called a string. In Python, strings represent textual data (may contain numbers too).
To store text in Python, you need to enclose it within quotation marks (single or double). For example, we can save the word Python within the language
variable and output it.
1234# Save string within variable language = 'Python' # Output string print(language)
Note that using quotation marks is compulsory. If you don't use them, then the error will be raised.
##Task
Assign the course name ('Introduction to Python') to the course
variable and output it.
Takk for tilbakemeldingene dine!
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Still meg spørsmål om dette emnet
Oppsummer dette kapittelet
Vis eksempler fra virkeligheten
Awesome!
Completion rate improved to 2.7
What is a String?
Sveip for å vise menyen
In one of the first chapters, you learned how to make the Python output message "Hello, Python!"
. This message is called a string. In Python, strings represent textual data (may contain numbers too).
To store text in Python, you need to enclose it within quotation marks (single or double). For example, we can save the word Python within the language
variable and output it.
1234# Save string within variable language = 'Python' # Output string print(language)
Note that using quotation marks is compulsory. If you don't use them, then the error will be raised.
##Task
Assign the course name ('Introduction to Python') to the course
variable and output it.
Takk for tilbakemeldingene dine!