What Is a String?
In the first chapter, you learned how to make Python output the message "Hello, Python!"
. This message is called a string. In Python, strings represent textual data (they 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 an error will be raised.
Assign the course name ('Introduction to Python') to the course
variable and output it.
Grazie per i tuoi commenti!
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Awesome!
Completion rate improved to 4
What Is a String?
Scorri per mostrare il menu
In the first chapter, you learned how to make Python output the message "Hello, Python!"
. This message is called a string. In Python, strings represent textual data (they 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 an error will be raised.
Assign the course name ('Introduction to Python') to the course
variable and output it.
Grazie per i tuoi commenti!