2.3 Progamming Page 3
Completion requirements
Newline
As we saw on the previous page, we can create an empty line using the print() function. This Output is also called a newline. Another way we can create a newline is by using a special symbol called a newline character.
newline character = \n
- The backslash is the escape character in Python. This means that the series of characters in the string escapes for the moment to introduce a special inclusion.
- The letter n placed after the backslash comes from the word "newline"
Practice 2.3
Type the following code into your compiler and click "RUN":print("Twinkle, twinkle,\nlittle star")
print()
print("How I wonder,\nwhat you are")
*NOTE: Don't forget about the escaping nature of "\". If a single backslash is used without it being paired or it is paired to another character that has no meaning, it will produce an error.