PYTHON
Python Programming
Python from first print() to real programs: data types, control flow, lists, dictionaries, functions, files, exceptions, OOP and generators.
0%complete
- Lessons
- 18
- Runnable examples
- 92
- Quiz questions
- 72
What you will be able to do
- Write clean Python with the right built-in types
- Use lists, tuples, sets and dictionaries fluently
- Write reusable functions, lambdas and comprehensions
- Read and write files and handle errors gracefully
- Build classes with inheritance and dunder methods
- Use iterators, generators and the standard library
Syllabus
Unit 1Python Basics
- 1Python IntroductionWhy Python is everywhere, how it runs your code, indentation, comments, print(), and your first programs.
- 2Variables & Data TypesDynamic typing, the core types (int, float, str, bool, None), type() and conversions, multiple assignment, and how Python variables are really references.
- 3Operators & InputArithmetic including // and **, comparison chains, logical and identity operators, input() with type conversion, and formatted output.
- 4StringsIndexing and negative indexes, slicing, immutability, the most useful string methods, searching, splitting and joining, and classic string programs.
Unit 2Control Flow
- 5If, Elif, Else & matchDecisions in Python: if/elif/else, nested conditions, the conditional expression, and structural pattern matching with match/case.
- 6Loops: for, while & rangeIterate with for over any sequence, count with range(), repeat with while, control loops with break, continue and the loop else clause, and write the classic loop programs.
Unit 3Data Structures in Python
- 7ListsPython's workhorse collection: creating, indexing and slicing lists, adding and removing items, sorting, copying, 2D lists and the list methods you will use daily.
- 8Tuples & SetsImmutable tuples for fixed records and packing/unpacking, and sets for uniqueness and fast membership — with union, intersection and difference.
- 9DictionariesKey–value storage with O(1) lookup: creating and updating dicts, safe access with get, looping over keys, values and items, nesting, counting and grouping.
- 10ComprehensionsBuild lists, sets and dictionaries in one readable line, add filters and conditions, nest them, and know when a plain loop is clearer.
Unit 4Functions & Modules
- 11FunctionsDefine reusable functions with def: parameters and return values, default and keyword arguments, *args and **kwargs, scope and the LEGB rule, and docstrings.
- 12Lambda, map/filter & RecursionSmall anonymous functions with lambda, functional tools map, filter, sorted and reduce, and recursive functions with base cases, memoisation and recursion limits.
- 13Modules, Packages & the Standard LibraryOrganise code into modules, import in different ways, use if name == "main", install packages with pip, and tour the standard library: math, random, datetime, os, collections and more.
Unit 5Real Programs
- 14File HandlingRead and write text files safely with open() and with, file modes, reading line by line, CSV and JSON files, and working with paths using pathlib.
- 15ExceptionsHandle errors gracefully with try, except, else and finally, read tracebacks, raise your own errors, and define custom exception classes.
- 16Object-Oriented PythonClasses in Python: init and self, instance vs class attributes, methods, properties, inheritance with super(), polymorphism, and dunder methods like str and eq.
- 17Iterators & GeneratorsHow for loops really work, the iterator protocol, writing generators with yield, lazy evaluation and infinite sequences, and generator pipelines.
- 18Python Cheat SheetPython on one page: syntax, built-in types and their methods, comprehensions, functions, files, exceptions, classes and the standard-library modules you will reach for most.