Python lessons
Ideal for beginners
Python is a programming language designed by Guido van Rossum in 1991 with the idea that "readability counts above all else." Unlike other languages that use curly braces and semicolons, Python uses indentation to structure code; this is why a Python program reads so straight that even someone with no coding background can roughly guess what it does.
Today, you see Python in three major fields. First is data and artificial intelligence: tables are cleaned with pandas, and models are trained with scikit-learn and PyTorch. Second is web backend: the server side is written with Django and Flask. Third is automation—tasks like renaming a thousand files in a folder, scraping data from a website, or sending a report email every morning.
Python is an interpreted language: you run the file you write directly without compiling it. This makes experimentation very fast—you write a line and see the result immediately. In return, it is slower than compiled languages like C or Rust; but since most libraries that do heavy calculations are written in C under the hood, in practice this difference is barely felt in most jobs.
- •→
Introduction to Python: Print and Repeat
From scratch, for someone who has never written code; the print command, variables, loops and functions — every line explained one by one, with colors.
- •→
Variables
What a variable is, how to create one, naming rules, multiple assignment and printing a value — from start to finish.
- •→
Data Types & Numbers
Text, integer, float, boolean; finding a type with type() and type conversion (casting).
- •→
Strings
Creating strings, concatenation, length, upper/lowercase, splitting, searching, and formatting with f-strings.
- •→
Lists
Creating lists, accessing elements, adding/removing, sorting, length, and iterating with a loop.
- •→
Conditions (if / elif / else)
Comparison operators, decision-making with if-elif-else, and/or logic, and the importance of indentation.
- •→
Loops (for / while)
Iterating over sequences with for, generating numbers with range, conditional repetition with while, break and continue.
- •→
Functions
Defining your own command with def, parameters, returning a value with return, and default values.
- •→
Operators
Math (+ - * / % // **), comparison (== != < >) and logic (and or not) operators.
- •→
Dictionaries
Storing key-value pairs, accessing a value, adding/updating, safe access, and iterating with a loop.
- •→
Tuples & Sets
Immutable tuples and duplicate-free sets — when to use which.
- •→
Error Handling (try / except)
Catching errors without the program crashing, different error types, and the finally block.
- •→
Classes (Object-Oriented)
Defining your own data type with class, creating objects with __init__, self and methods.
- •→
File Operations
Creating, writing, reading a file with with open(), and the append modes (w / r / a).
- •→
Comments & Indentation
Comment lines with #, and Python's most critical rule: indentation (whitespace) defines blocks.
- •→
Booleans (True / False)
True/false values, comparisons producing a bool, and the "empty/full" truthiness rules.
- •→
Lambda & map / filter
One-line anonymous functions (lambda) and using them with map/filter/sorted.
- •→
Modules (import)
Using ready-made libraries with import: math for mathematics, random for random numbers.
- •→
Inheritance
A class inheriting attributes and methods from another class; method overriding.
- •→
Variable Scope
Variables inside (local) and outside (global) a function; the global keyword.
What you will learn
- Printing to the screen with print and storing information in variables
- Distinguishing basic data types such as text, numbers, lists, and dictionaries
- Making decisions with if, and repeating with for and while
- Writing your own functions and breaking down code into pieces
- Reading and writing files, and catching errors with try
- Importing and using ready-made libraries
Who is this for?
- People who have never written code and are choosing their first language — Python is the one that starts with the fewest barriers
- Those who want to pivot into data analysis, artificial intelligence, or automation
- Developers who know another language and are looking for a practical tool for quick prototyping
When to use?
For data processing, machine learning, scientific computing, automation scripts, and medium-scale web backends, Python is the first choice: its ready-made library ecosystem is unmatched.
On the other hand, Python is not suitable for tasks where every millisecond counts, such as game engines, embedded systems, and operating system kernels; languages like C, C++, or Rust are preferred there. Those who want to develop mobile applications should also look at Swift, Kotlin, or Dart.
Frequently asked questions
How long does it take to learn Python?
You can nail down the basic syntax—variables, conditions, loops, functions—in two to three weeks of regular study. You typically reach a level where you can write small programs on your own in two to three months. A specialization area like data science or web development adds months on top of that. The deciding factor is not the number of lessons, but the number of lines you write yourself.
Should I learn Python 2 or Python 3?
Python 3. Official support for Python 2 ended in 2020, and new libraries only work with Python 3. If you see the print command used without parentheses in older code, that is Python 2; all examples on this site use Python 3.
Is Python slow?
Pure Python code is dozens of times slower than its equivalent written in C. However, in real-world work, libraries like NumPy and pandas do the heavy lifting, and their core is written in C. So the bottleneck is usually not your code; if you notice slowness, you first need to measure which line is spending the time.
Can you write mobile apps with Python?
Technically it is possible with Kivy or BeeWare, but in practice it is not recommended: in terms of store rules, performance, and UI compatibility, Swift for iOS, Kotlin for Android, and Dart/Flutter for both are much more mature options.
Summary
Thanks to its readable syntax and vast library ecosystem, Python is powerful both as a first language and as a professional tool. In this tutorial, we start with print and progress all the way to functions, file operations, and error handling; you can run each lesson's code in the browser and see its output instantly.