Python is a programming language: a way of giving instructions to a computer in words it can follow. It is popular because it reads almost like English, so beginners can focus on ideas instead of strange symbols. People use Python to build websites, analyse data, automate boring tasks and create artificial intelligence.
What you need
Install Python 3 from python.org (the website has installers for Windows, Mac and Linux), or use a free online Python editor in your browser if you cannot install anything. To check it works, open a terminal or command prompt and type python --version (on some systems python3 --version). You should see a version number starting with 3.
Your first program
A program is a list of instructions, run from top to bottom. The simplest instruction is print(), which shows text on the screen. Text goes inside quotation marks.
print("Namaste, world!")
print("I am learning Python")
Output:
Namaste, world!
I am learning Python
Each print() shows its text on a new line. Save the lines in a file called hello.py and run it with python hello.py, or type them straight into your online editor.
Comments: notes for humans
A line starting with # is a comment. Python ignores it, so you can leave notes to yourself and others.
# This line is a comment, Python skips it
print("Comments help people read code") # a note at the end of a line
Output:
Comments help people read code
Four mistakes every beginner makes
- Capital letters matter.
Printis notprint. - Quotes must match. Start and end text with the same kind of quote mark.
- Brackets must close. Every
(needs a). - Typos. Read the error message: Python tells you the line number where it got confused.
Errors are normal. Even experienced programmers see them every day. Read the message, fix the line, run again.
Try it yourself
- Print your own name on one line and your school or city on the next.
- Add a comment above them explaining what the program does.
- Break something on purpose (remove a closing quote) and read the error message.
Next lesson: storing information in variables.

Comments
Loading comments…