Getting started with Python
What Python does
Understand what a Python script is and choose a task you want to automate.
Lesson 1 of 63
Reading: about 2 min
Lesson + practice: about 6 min
Difficulty: Beginner
On this page4 sections
Python is a programming language for giving a computer instructions. People use it to automate repetitive work, analyse data, build websites, and create programs. The examples in this roadmap target Python 3.10 or newer.
Programs and scripts
A program is a set of instructions. A script is a file containing those instructions. Python checks the script for syntax errors before it runs. In a valid script, statements then execute in order from top to bottom.
print("Hello, Python!")Hello, Python!
This one-line script asks Python to display a message. You will create and run it later in this chapter.
Why this works
A saved script is useful when you want the same instructions to run again. The computer follows the instructions you write; it does not infer your intention. Small, visible outputs make it easier to check whether a program did what you expected.
Practice
Write down one task you would like to do with Python. It can be small, such as renaming files or calculating a total. You do not need to know how to build it yet.
What is a Python script?
Reveal answer
A file containing Python instructions that you can save and run.
Try another case
Name one instruction you could repeat in a script and one result you could check.
Check your answer
Reveal answer
For example, print a greeting each time the script runs, then check that the greeting appears in the terminal.
Your progress
Reveal the check answer or reach the end to complete this lesson.