(Python) Printing text to the screen


In the module "Let's get acquainted" we had a program that looked like this
print("Hello, World!") 
This program outputs the text Hello, World!
The text will be outputed without quotation marks.
Thus, to output something on the screen, a built-in command is used (function, operator) - print 
In quotation marks, the text for output is written - that is, some character string
As required by Python, there should be no spaces at the beginning of a line
Text can be written not in quotation marks, but in apostrophes (single quotation marks), for example
print('Hello, World!') 
Using quotes is convenient if you need to display the quotes themselves on the screen.
For example:
print('Read the book "Programming for Everyone"!') 
REMEMBER
To output something, use the operator print()
In parentheses, write what we display, write character strings in quotation marks or apostrophes
3 We do not put spaces at the beginning of the line before the print command!

Let's practice displaying something on the screen!

Inside the brackets, you can write several character strings, separated by commas, all of them will be automatically displayed on the screen with a space.
If the space between the lines is not needed, then when calling the function, you need to add another argument with the name sep = "" (the value of the argument is equal to an empty line) For example, the output of the phrase
Hello,World!
(without spaces),
can be organized in this way
print("Hello,","World!",sep="")
Each new print command outputs text from a new line.
For instance. when writing such a program
print("Hello,")
print("World!")
Appears on the screen
Hello, 
World!
You can cancel a newline by using the argument end = "" (the value of the argument is equal to an empty line)

REMEMBER
1 Each print command outputs text from a new line
2 When specifying multiple character strings, inside one print command, all strings will be displayed with a space
3 If the space needs to be removed, at the end we write sep = ""
4 When writing multiple output commands, you can cancel the transition to a new line. To do this, add the end = "" argument at the end

Practice solving the problem!

Special characters

Many programming languages have special characters that just can not be output.
For example, commonly used special characters are backslash (\), quotation marks (") and apostrophes (')
Note that a regular slash (/) is not a special character!

To output such characters, we put a \ in front of each of them. That is, if we want to display the sign \, then in the output operator it is necessary to write \\

 
REMEMBER
To display the characters \, ", ', you must put a \ in front of them

Let's practice!