Python Introduction
Python is a programming language whose code reads almost like plain English. It is one of the most widely used languages in the world because beginners can pick it up quickly, yet professionals use the very same language to build websites, analyse data, train AI models and automate boring work.
What is Python?
Python is a high-level, general-purpose programming language created by Guido van Rossum and first released in 1991. The name comes from the British comedy show Monty Python's Flying Circus, not from the snake. Python is free and open source: anyone can download it, use it and look at how it is built.
- High-level means you describe what you want in human-friendly words, and Python takes care of low-level details such as managing the computer's memory.
- General-purpose means it is not tied to one job. The same language works for a school project, a banking system or a research lab.
Here is a tiny Python program. Don't worry about the details yet; just notice how readable it is.
# Your first taste of Python
name = "Amani"
print("Hello,", name)
print("Welcome to Kuza Ndoto!")
Why learn Python?
- Easy to read and write: no curly braces or semicolons. Blocks of code are shown with indentation, which keeps programs tidy.
- Very versatile: web apps with Django, data analysis with pandas, AI with scikit-learn and PyTorch, and scripts that automate everyday tasks.
- In demand: Python consistently ranks among the most requested skills in tech job adverts around the world, including in East Africa's growing tech hubs.
- Huge community: hundreds of thousands of free add-on packages, and answers to almost any beginner question online.
To see the difference in style, compare a "hello" program in Java with the Python version.
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, Amani");
}
}
print("Hello, Amani")
Both print the same line, but Python needs one line instead of five. Less ceremony means you can focus on solving the problem.
What can you build with Python?
| Area | Examples | Popular tools |
|---|---|---|
| Web development | Websites, APIs, school portals, dashboards | Django, Flask, FastAPI |
| Data science | Analysing sales, survey or mobile money data | pandas, NumPy, Matplotlib |
| AI & machine learning | Chatbots, crop disease detection, predictions | scikit-learn, PyTorch |
| Automation | Renaming hundreds of files, sending reports, filling spreadsheets | os, csv, openpyxl |
| Education & science | Simulations, maths homework helpers, research analysis | Jupyter, SciPy |
Python is interpreted
Python runs your code using a program called the interpreter. You write instructions in a file (or type them straight in), and the interpreter carries them out from top to bottom. There is no separate, slow "build" step before you can see a result, so you can try an idea, run it and adjust it within seconds. You will learn exactly what happens behind the scenes on the How Python Runs Your Code page.
fare = 120 # one matatu fare in KES
trips = 2 * 22 # there and back, 22 working days
print("Monthly fare:", fare * trips)
Even this short program shows the key ideas you will meet in the coming pages: storing values in variables, doing arithmetic and printing results.
Python 2 vs. Python 3
Python 3 was released in 2008 and fixed many design problems in the older Python 2. Python 2 reached its official end of life on 1 January 2020 and no longer receives updates, not even security fixes.
This series uses Python 3, and all examples are written for version 3.12 or newer. If you find an old tutorial that writes print "hello" without brackets, it is Python 2 code and will not work as written.
How this series is organised
Each page explains one idea, shows small examples with their exact output and points out common mistakes. Work through the pages in order: first set up your computer on Installing Python & VS Code, then write your first program. Type the examples yourself instead of copying them; your fingers learn as much as your eyes.
Key points
- Python is a free, high-level, general-purpose language created by Guido van Rossum and first released in 1991.
- Its readable syntax makes it ideal for beginners, and its libraries make it powerful for professionals.
- The same language powers websites, data analysis, AI and automation.
- Python is interpreted, so you can run code and see results immediately.
- Always use Python 3; this series targets version 3.12 or newer.
Tip: use the ← and → keys to move between pages.
