LESSON 1 / 5 · 6 MIN
Introduction to Python
LET'S MAKE IT CLICK
Meet Python
A program is a set of instructions. Python is a language for writing those instructions in a form a computer can follow.
Start with something you want to calculate.
Tell Python how to get the result.
Inspect the answer.
Programming connects a task to a result through explicit instructions.
Move through one idea at a time. Watch, experiment, and check your understanding along the way.
What can you do with Python?
Combine repetitive steps.
Explore patterns in information.
Create services and applications.
Different projects share the same building blocks: values and instructions.
Automate repetitive tasks, work with data, build web services, or create tools that use AI. The same foundations—values, variables, decisions, and loops—appear in all of these projects.
You do not need to memorize every command. Start by connecting a small instruction to its result, then combine instructions into something useful.
Your first mental model
A name refers to the starting value.
5 multiplied by 60 gives a new value.
print(seconds) shows the result.
Follow the sequence from top to bottom. A later statement can use an earlier value.
In the examples here, Python follows statements from top to bottom. Some instructions create a value; others transform it or display a result. Later, conditions and loops will change that flow.
See the Python code
minutes = 5
seconds = minutes * 60
print(seconds)Keep in mind
print() displays a value. The equals sign assigns a value to a variable; it does not ask whether two things are equal.
YOUR TURN TO EXPLORE
Choose a task. Follow the instructions.
Pick a small task and step through its program. Notice how values become a result.
No assignments yet.
OUTPUT
No output yet.
Predict the result, then take the first step.
Code, interpreter, output
The instruction you write.
Python evaluates the instruction.
The displayed result.
Code, the interpreter, and output have different roles.
Code is the text you write. A Python interpreter runs that code. Output is what the program displays, such as the number 300 in the time-conversion example.
The interactive examples in this course let you inspect specific programs without installing Python. When you move to your own projects, you can run Python in a terminal, an editor, or a notebook.
Errors are information
A number and text cannot be added this way.
The error identifies incompatible types.
Use two numbers to produce 5.
An error is useful feedback. Change one thing, then test the result.
A typo or an unsupported operation can stop a program. The error message tells you what Python could not do. Learning to read those messages is part of learning to program.
Keep experiments small: predict a result, run the example, and compare the result with your prediction.
TAKE IT WITH YOU
What you have learned
- A program combines instructions to perform a task.
- Simple Python programs run statements in order.
- Output helps you inspect what a program is doing.
Answer both quick checks correctly to mark this lesson complete. You can continue at any time.