On a phone you can read the lesson vertically. For code and interactive tasks, it is more comfortable to rotate the screen horizontally.
Lesson 001
001. First commands: show text
We are not installing Python yet. We are trying the first command right in the browser.
What we will make
- show text;
- understand the
printcommand; - change the text inside quotes;
- check the code in a learning terminal.
First command
print("Hello, Python!")
print shows text on the screen.
Parentheses pass data to the command: what exactly should be shown.
Quotes mean plain text. Python will not look for a variable with that name.
If you forget a quote or a parenthesis, the command breaks: Python cannot see where the text or command ends.
The command has the name print, parentheses, and text inside quotes.
Python reads the line and shows the text that is inside the quotes.
The most common problems are the command name, quotes, or the closing parenthesis.
Change the text inside the quotes, but keep print and the parentheses in place.
Try it yourself
Hint: change only the text inside the quotes.
Success is not counted yet.
Common errors
pritn("Hello")- typo in the command name.print(Hello)- plain text is missing quotes.print("Hello"- the command started, but the parenthesis was not closed.
Mini-test
Which command shows text?
Why do we need quotes?
What happens if you forget the closing parenthesis?
Next step
Home improvement
Show your name, the title of your favorite game, or a message to the player.