One-sentence summary
Python is an easy-to-read programming language, close to human language, and it is used in many different places — from websites and artificial intelligence to robots and automation.
Why does it matter?
Until now you have dragged and dropped blocks in Scratch. Blocks are great for getting started: you can see the commands and you cannot snap them into the wrong place. But once you begin writing large projects, blocks slow down and the screen gets crowded.
A text-based language lets you type the commands with a keyboard instead. You write faster, you can copy and share your code easily, and you move on to the tools that professionals use.
Python is one of the most recommended languages for making that move to text-based coding. Its commands read almost like plain English sentences. In this lesson we will learn what Python is, where it is used, and how it takes the place of blocks.
Short definition: Python is an easy-to-read programming language in which we write commands as plain text, and it is used across many fields.
What is Python?
A programming language is a language we use to tell a computer what to do. People speak languages such as English or Turkish; to give commands to a computer, we use a programming language.
Python was released in 1991 by Guido van Rossum. Its name does not come from the snake but from a comedy group ("Monty Python"). The thing its creator cared about most was that code should be readable.
Why is Python readable?
The command below prints a message on the screen:
print("Hello world")
Even someone who has never seen code can roughly read this line: "print" means display, and the text inside the quotation marks is what will appear on the screen. When you run it, you see:
Hello world
Doing the same job in another language might take more lines and more complicated symbols. Python reduces it to a single line. The simpler the code is, the easier it becomes to find a mistake.
You can also give print more than one piece of text. If you put a comma between them, Python writes them side by side:
print("Hello", "Doruk")
This line prints Hello Doruk on the screen. As you can see, the command is the same; only the text we put inside it changes.
Indentation matters
In Python we show which block a command belongs to by using indentation. Indentation is the space at the start of a line. We usually use 4 spaces.
age = 12
if age >= 10:
print("This lesson is right for you")
print("Let's begin")
Here the two lines below the if line start 4 spaces in. That space tells Python, "these lines are inside the condition." In Scratch, blocks nested inside one another; in Python, indentation does the same job.
Where is Python used?
Python does not belong to a single field. You can use the same language for very different jobs. Here are the most common areas:
Web, data and artificial intelligence
- Websites: Python code runs behind large services such as Instagram and Spotify.
- Data analysis: It is used to examine tables with thousands of rows and produce charts.
- Artificial intelligence: Photo recognition, translation and chatbots are often built with Python.
Automation and robotics
- Automation: You can write small programs that do repetitive jobs for you, such as renaming files or organising email.
- Robotics and micro:bit: You can program the micro:bit board and many robots with a simplified version of Python (MicroPython).
For example, we can make a robot beep 3 times like this:
for i in range(3):
print("Beep")
The phrase for ... in range(3) means "repeat this 3 times." Do you remember the "repeat 10 times" block in Scratch? This is its written form.
From blocks to text-based code
The ideas you learned in Scratch are not lost; only their appearance changes. The same three basic structures exist in Python too: sequence, condition and repetition.
Comparing blocks with Python
In Scratch, when you wanted a character to say "Hello," you used a purple "say" block. In Python the same idea is a single line:
| Scratch block | Python code |
|---|---|
repeat 10 | for i in range(10): |
if ... then | if ...: |
say ... | print("...") |
set variable to ... | variable = ... |
Two examples side by side
A condition example. In Scratch you would stack "if score > 100 then say 'You win'" blocks. In Python it looks like this:
score = 120
if score > 100:
print("You win")
else:
print("Keep going")
The logic here is exactly the same as in Scratch. Instead of dragging blocks, you type the lines. The word else means "otherwise"; it matches the "if-else" block from Scratch.
Mini practice
Write the short program below on paper or in a notebook. You do not need to run it on a computer yet; our goal is to read the code and predict what it will do.
print("Name: Doruk")
print("Favourite subject: coding")
for i in range(2):
print("I am learning Python")
Tasks
- How many lines does this program print on the screen? Count them and note it down.
- If you remove the last two lines (the
forline and the one below it), how does the output change? - Change the first two lines so they show your own name and favourite subject.
- If you write
range(4)instead ofrange(2), how many times is "I am learning Python" printed?
In the next lesson we will actually run programs like these. For now, getting used to reading the logic of the code is enough.
Common mistakes
Forgetting the quotation marks
The text you want to print must be inside quotation marks. Wrong: print(Hello). Right: print("Hello"). Without the quotes, Python thinks "Hello" is a command and gives an error.
Getting the indentation wrong
The commands below an if or for line must start further in. If you forget the indentation, or use 2 spaces on some lines and 4 on others, Python gives an error. Always use the same number of spaces within one block.
Forgetting the colon
The if, else and for lines end with a colon (:). Forgetting it is one of the most common beginner mistakes.
Thinking "Python is hard"
Python was designed precisely so that beginners could read it. Typing text instead of using blocks feels a little slow on the first day; after a few tries it speeds up.
Safety note
Coding is a safe activity that runs on your screen. Even so, keep two simple rules in mind: do not blindly run code you found online or that someone sent you; only run code you understand and trust. Also, do not put personal information such as your real address, phone number or passwords into your programs. If you are going to install a new program or tool, do it together with an adult.
Review questions
- What makes Python suitable for a first text-based programming language?
- How does an interpreter differ from a program that is compiled before running?
- Why does readable code still require careful design and testing?
- Which tasks are appropriate for a small beginner Python project?
- What should be checked before running code copied from the internet?
- How can a tiny program demonstrate input, processing and output?
Answers
- Its syntax is relatively readable, it has broad learning resources and it supports projects from simple scripts to data and hardware work.
- An interpreter executes Python instructions through the Python runtime, while compiled workflows translate code into another form before execution.
- Readable syntax does not guarantee correct requirements, safe inputs, accurate calculations or sensible structure.
- Examples include a quiz, calculator, study planner, text analyser or small data summary with clear boundaries.
- Understand every line, verify the source, inspect file and network actions, check dependencies and run it in a safe environment.
- Read a value, transform or compare it, and print a result together with a helpful label.
Lesson summary
- Python is an easy-to-read programming language in which we write commands as plain text.
- Being readable and multi-purpose makes it a good first text-based language for beginners.
- It is used in many different fields, such as web, data analysis, artificial intelligence, automation and robotics.
- The Scratch ideas of sequence, condition and repetition appear in Python as
print,ifandfor. - In Python, indentation (space at the start of a line) marks the edge of a block, and
if/forlines end with a colon.
Check your understanding
- What is the most important feature that makes Python easy to read?
- What appears on the screen when
print("Hello world")runs? - In Python, what decides which block a command belongs to?
- Name three different fields where Python is used.
- What is the Python equivalent of the Scratch "repeat 10 times" block?
Answers
- The fact that the code reads almost like everyday language; commands are written clearly and simply.
- The text
Hello worldappears on the screen, without the quotation marks. - Indentation, that is, the space at the start of a line (usually 4 spaces).
- For example: websites, data analysis, artificial intelligence, automation and robotics/micro:bit (any three).
- The phrase
for i in range(10):; it is used to repeat a job a set number of times.
Source and verification note
For “What Is Python and Where Is It Used?”, verification focuses on whether the relationship between What is Python? and Indentation matters remains consistent across examples. Code examples follow Python 3 syntax. Small differences may appear between environments, so examples should first be tested in a safe online editor or a local development setup.
Next lesson
The Development Environment and Your First Program: We will install Python on your computer and learn to actually run your first program.