Free · Python 3.12+
Python Programming
The most readable way into programming: from your first print() to OOP, files, exceptions, generators, decorators, APIs and databases.
- 306
- Tutorials
- 25
- Projects
- 225
- Practice MCQs
- 52 h
- Reading time
What you will learn
- Write clear, correct Python 3 programs
- Use strings, lists, tuples, sets and dictionaries fluently
- Structure code with functions, modules and packages
- Build classes using object-oriented principles
- Work with files, JSON, exceptions, iterators, generators and decorators
- Call web APIs and store data in a database
Syllabus
20 modules · 306 topics
What Python is, where it came from, where it is used, and how to install it, set up VS Code and run your first programs.
- What is Python? 12 min
- History of Python 12 min
- Why Python is popular 10 min
- Features of Python 14 min
- Applications of Python 12 min
- Python in real-world development 14 min
- Python compared with other languages 14 min
- Installing Python 15 min
- Setting up VS Code 15 min
- Installing Python extensions 12 min
- Writing your first Python program 15 min
- Understanding the Python interpreter 14 min
- Source code and execution 15 min
- Interactive mode versus script mode 12 min
The grammar of Python: indentation, statements and expressions, comments and docstrings, keywords and names, input and output, type conversion and reading syntax errors.
How Python stores and names values: variables and assignment, dynamic typing, numbers, strings, Booleans, None, type checking and conversion, mutability and a first look at scope.
- Variables 12 min
- Assignment 12 min
- Naming rules 10 min
- Dynamic typing 12 min
- Integers 12 min
- Floating-point numbers 14 min
- Strings 12 min
- Booleans 10 min
- Complex numbers 10 min
- type() 10 min
- Type casting 12 min
- Mutable and immutable objects 14 min
- None 10 min
- Multiple assignment 10 min
- Variable scope introduction 12 min
Every Python operator in depth: arithmetic, comparison, logical, assignment, bitwise, membership and identity operators, then how precedence and associativity decide the order of evaluation.
- Arithmetic operators 12 min
- Addition 10 min
- Subtraction 10 min
- Multiplication 10 min
- Division 12 min
- Floor division 10 min
- Modulus 12 min
- Exponentiation 10 min
- Comparison operators 12 min
- Logical operators 14 min
- Assignment operators 10 min
- Bitwise operators 14 min
- Membership operators 10 min
- Identity operators 10 min
- Operator precedence 12 min
- Associativity 10 min
How programs make decisions: if, if-else and if-elif-else, nested and combined conditions, conditional expressions, truthiness and the mistakes beginners make most often.
Repeating work with while and for loops: range(), how loops execute, nested loops, break, continue, pass, avoiding infinite loops, loop else clauses and the basics of iteration.
Working with text in depth: creating strings, indexing and slicing, joining and repeating, immutability, the essential string methods, formatting with format() and f-strings, escapes and multi-line text.
- Creating strings 10 min
- Indexing 10 min
- Negative indexing 8 min
- Slicing 12 min
- Concatenation 10 min
- Repetition 8 min
- Immutability 10 min
- String methods 12 min
- upper() 8 min
- lower() 8 min
- strip() 10 min
- replace() 10 min
- split() 12 min
- join() 10 min
- find() 10 min
- count() 8 min
- startswith() 8 min
- endswith() 8 min
- String formatting 12 min
- f-strings 12 min
- Escape characters 10 min
- Multiline strings 10 min
Lists, tuples, sets and dictionaries in depth: creating, indexing, slicing, updating and nesting them, set algebra, dictionary methods, and how to choose the right structure for a problem.
- Data structure introduction 12 min
- Lists 12 min
- List creation 10 min
- Indexing 10 min
- Slicing 12 min
- List methods 12 min
- Adding and removing elements 12 min
- Updating elements 10 min
- Nested lists 12 min
- Tuples 10 min
- Tuple operations 10 min
- Sets 10 min
- Set operations 12 min
- Union 8 min
- Intersection 8 min
- Difference 8 min
- Dictionaries 12 min
- Dictionary keys and values 10 min
- Updating dictionaries 12 min
- Dictionary methods 10 min
- Nested dictionaries 12 min
- Choosing appropriate data structures 14 min
Defining and calling functions, parameters and every kind of argument (positional, keyword, default, *args, **kwargs), return values, scope, lambdas, recursion, docstrings and good function design.
- Functions 10 min
- Function definition 10 min
- Function calls 10 min
- Parameters 10 min
- Arguments 10 min
- Positional arguments 8 min
- Keyword arguments 8 min
- Default arguments 10 min
- *args 8 min
- **kwargs 8 min
- Return statements 8 min
- Multiple return values 8 min
- Local variables 8 min
- Global variables 8 min
- Scope 12 min
- Lambda functions 8 min
- Recursion 15 min
- Docstrings 8 min
- Function best practices 12 min
List, dictionary and set comprehensions (with conditions and nesting), generator expressions, iterables and iterators, iter() and next(), generator functions with yield, and lazy evaluation.
Classes and objects, attributes and methods, constructors and self, instance and class variables, class and static methods, encapsulation, every form of inheritance, overriding, polymorphism, abstraction, abstract classes, properties, special methods and composition.
- Introduction to OOP 10 min
- Classes 10 min
- Objects 10 min
- Attributes 10 min
- Methods 10 min
- Constructors 10 min
- __init__() 10 min
- self 8 min
- Instance variables 8 min
- Class variables 8 min
- Instance methods 8 min
- Class methods 10 min
- Static methods 8 min
- Encapsulation 10 min
- Inheritance 12 min
- Single inheritance 8 min
- Multiple inheritance 12 min
- Multilevel inheritance 8 min
- Method overriding 10 min
- Polymorphism 10 min
- Abstraction 8 min
- Abstract classes 10 min
- Properties 10 min
- Special methods 12 min
- Composition 10 min
What exceptions are, syntax versus runtime errors, the common built-in exceptions, try/except/else/finally, handling several exceptions and exception groups, raising and chaining exceptions, custom exception hierarchies and best practices.
Opening, reading, writing and appending files, file modes, closing and with statements, text, CSV and JSON files, paths, directories, pathlib and the exceptions file operations raise.
Modules and how import works, creating your own modules, from-imports and aliases, a tour of the standard library, packages and __init__.py, installing packages with pip, virtual environments, requirements.txt and organising real projects.
A practical tour of the most useful standard modules: math, random, datetime, time, os, sys, pathlib, json, csv, collections, itertools, statistics and re.
Choosing and installing third-party libraries, dependencies and virtual environments in practice, first steps with NumPy, pandas, Matplotlib and requests, and calling web APIs: HTTP requests, JSON responses and working with external data.
Mutability, references, shallow and deep copies, memory management and garbage collection, first-class functions, closures, decorators, context managers, type hints, annotations, dataclasses and enums.
What algorithms are, a problem-solving method, flowcharts and pseudocode, time and space complexity, Big-O notation, linear and binary search, bubble, selection and insertion sort, recursion problems, stacks, queues, frequency counting, two pointers and common problem-solving patterns.
- Algorithms 8 min
- Problem-solving methodology 10 min
- Flowcharts 8 min
- Pseudocode 8 min
- Time complexity 10 min
- Space complexity 8 min
- Big-O notation 10 min
- Linear search 8 min
- Binary search 10 min
- Bubble sort 8 min
- Selection sort 8 min
- Insertion sort 10 min
- Recursion problems 12 min
- Stacks 10 min
- Queues 10 min
- Frequency counting 10 min
- Two-pointer techniques 10 min
- Common problem-solving patterns 12 min
Debugging methodically, kinds of programming errors, reading tracebacks, the VS Code debugger and print/logging debugging, assertions, unit testing with unittest and pytest, designing test cases, PEP 8, readability, naming, documentation, code organisation and maintainable programs.
- Debugging 10 min
- Programming errors 8 min
- Reading tracebacks 8 min
- VS Code debugging 10 min
- print-based debugging 8 min
- Assertions 8 min
- Unit testing 12 min
- pytest 12 min
- Writing test cases 10 min
- PEP 8 8 min
- Code readability 8 min
- Naming conventions 8 min
- Documentation 10 min
- Code organization 10 min
- Maintainable programs 10 min
Planning an application, breaking it into components, structuring the program, functions and classes in application design, input validation, application-level exception handling, data persistence and JSON storage, testing and debugging applications, improving code quality and preparing projects for demonstration.
- Application planning 10 min
- Breaking problems into components 10 min
- Program structure 10 min
- Functions and modularity 10 min
- Classes and application design 12 min
- Input validation 10 min
- Exception handling 10 min
- Data persistence 10 min
- JSON storage 10 min
- Application testing 12 min
- Debugging applications 10 min
- Improving code quality 10 min
- Preparing projects for demonstration 10 min
Projects
All 25 projectsStudent Grade Manager
Validate a class's marks, rank students with shared ranks for ties, assign grades with a per-subject pass mark and find each subject's toppers.
BeginnerNumber Guessing Game
Guess a secret number with higher/lower hints, warmth clues, limited attempts, replays and a best score — repeatable with a seed.
IntermediateLibrary Management System
Books, members, 14-day loans, late fines, borrowing limits, searches and overdue reports, with every rule enforced by custom exceptions.
IntermediateBank Account System
Savings and current accounts with a minimum balance, an overdraft, transfers, monthly interest and statements — using inheritance and exact Decimal money.
AdvancedSudoku Solver
Solve any Sudoku with constraint propagation (naked and hidden singles) plus a most-constrained-cell backtracking search, and reject invalid puzzles.
AdvancedMaze Solver
Find paths through grid mazes and compare breadth-first search, depth-first search and A* by path length and cells explored.