Module 2 - Section 0 - Repetition is the mother of knowledge
Concepts of Module 1 repeated.
2.0.1 - Printing in Python
Let's remember them starting with Print command.
As we learned, Print is an output command which sends its results to the screen.
print("Hello World") sends the message Hello World to the screen.
Anything inside the parentheses will be printed on screen, if the syntax is right.
We can print plain text as the previous example (using always the quotes characters "" or ''),
the results of algebric operations inside parentheses (using the standard algebric operations' priority),
or combinations of the above examples:
>>> print("The second power of 4 equals to",4**2)
The second power of 4 equals to 16
We can also declare that the separator between numbers will be a character instead of the space character:
If we need to print something moving to a new line we use the escape code \n:
>>> print('First line.\nSecond line.')
>>> print("The file is stored in C:\\new folder")
The file is stored in C:\new folder