Python Tutorial
Learn Python from your first print() to files, classes, NumPy and Pandas. Every lesson has examples you can edit and run in your browser, a short quiz, and a set of practice programs with fully explained solutions.
- 47 lessons in a sensible order
- Runnable examples in every lesson
- Quizzes and exercises to check yourself
- 900+ practice programs with solutions
Run your first Python program
Press Try it, change the name, then press Run. The code runs with real Python inside your browser, so there is nothing to install yet.
name = "SQA Tools"print("Hello,", name)print("2 + 3 =", 2 + 3)Hello, SQA Tools 2 + 3 = 5
How this tutorial works
- Read the lesson. Each topic starts with the idea in plain words, then shows small examples with their real output.
- Edit and run the examples. Every Python example has a Try it button. Change the code and run it to see what happens.
- Check yourself. Each lesson ends with a quiz and an exercise with hints and a solution.
- Practise. The Program Practice section links to programs for that topic. Every solution explains the approach, walks through the code line by line and shows the real output.
New to programming? Go in order. Each lesson only uses what earlier lessons taught. If you already know another language, skim Getting Started and Basics, then jump to the topic you need.
Python tutorial syllabus
Getting Started
Basics
Control Flow
Strings
Data Structures
Functions
Object-Oriented Python
Errors
Modules
File Handling
Libraries & Databases
Python practice programs
Practice sets are grouped by topic. Pick one that matches the lesson you just finished.
Why learn Python?
- Readable. Python code reads almost like English, so you spend your time on the problem, not on punctuation.
- Everywhere. Python is used for test automation, web back ends, data analysis, machine learning, scripting and DevOps tooling.
- Huge library. The standard library covers files, dates, JSON, CSV, regular expressions and more, and PyPI adds hundreds of thousands of packages.
- Great for testers. Selenium, Playwright, pytest and requests make Python a first choice for automation. When you finish here, continue with the Playwright with Python tutorial.
Python tutorial FAQ
Is this Python tutorial free?
Yes. All 47 lessons, quizzes and practice programs on sqatools.in are free to read and run.
Do I need to install Python to follow along?
Not at first. The Try it button runs examples in your browser. Install Python when you reach Install Python so you can write your own scripts.
How long does it take to learn Python?
Most beginners can finish the Getting Started, Basics, Control Flow and Data Structures lessons in two to three weeks at an hour a day. Practising programs after each lesson is what makes it stick.
Which Python version does this tutorial use?
The examples are written for Python 3 and were run with a current Python 3 release. The in-browser Try it runs Python 3.12, so a few newer features may behave differently there.