In this chapter, you learned the following:
Python uses type str to represent text as sequences of characters.
Strings are created by placing pairs of single quotes ’ or double quotes " around the text.
| | '''Should you want a string |
| | that crosses multiple lines, |
| | Use matched triple quotes.''' |
Special characters like newline (\n) and tab (\t) are represented using escape sequences that begin with a backslash. For example, ’this string\nspans\nthree lines’.
Values can be printed using the built-in function print, and input can be provided by the user via the built-in function input.
Formatted strings (f-strings) are a modern, efficient way to construct text using embedded expressions and format specifiers.