Free demoJob-oriented courses at Debugshala, Old Palasia, Indore. Freshers, non-IT and year-gap welcome.Book a free demo +91-8982385539
Free course · by Debugshala, Indore

Python Tutorial

52 free lessons, in the order we teach them in class: start at lesson 1 and work down. Every lesson has an analogy, a diagram, code you can run or copy, a quick quiz and an FAQ.

  • 52Lessons
  • 9Modules
  • ~8 hReading time
  • FreeAlways

01Python Introduction

  1. Getting Started with Python: Try It Online, Then Install ItRun Python in your browser right now, then install Python and VS Code on Windows, macOS or Ubuntu step by step and run your first .py file with confidence.
  2. Your First Python Program: print(), Order and Error MessagesWrite your first Python program step by step: how print() works, why code runs top to bottom, sep and end, and how to read beginner error messages calmly.
  3. Python Comments: Single-line, Multi-line and DocstringsHow Python comments work: the # symbol, inline and multi-line comments, docstrings, commenting out code to debug, and habits that keep scripts clear.
  4. Python Keywords and Identifiers: Rules, List and ExamplesLearn Python's 35 keywords, the four soft keywords and the naming rules for identifiers, with runnable checks and examples taken from real data sheets.
  5. Python Virtual Environments and pip: A Beginner's Setup GuideCreate a Python virtual environment with venv, install pandas with pip and share a requirements.txt, with steps for Windows, macOS and Linux.

02Python Fundamentals

  1. Python Variables and Literals: Assignment, Types and ExamplesLearn how Python variables work as names for values, how assignment and reassignment behave, and every kind of literal: numbers, strings, booleans and None.
  2. Python Type Conversion: Implicit vs Explicit Casting GuidePython type conversion explained: when Python converts types for you, how int(), float(), str() and bool() cast values, and how to clean numbers in text.
  3. Python Input and Output: input(), print() and f-stringsLearn Python input and output: read user input with input(), convert it to numbers safely, and format clean reports with print() and f-strings, with examples.
  4. Python Operators: Arithmetic, Comparison, Logical and MoreLearn every Python operator family with runnable examples: arithmetic, comparison, logical, assignment, membership and identity, plus the precedence rules.
  5. Python Numbers and the math Module: int, float and RoundingUnderstand Python int, float and complex numbers, why 0.1 + 0.2 is not 0.3, how round() really works, and the math functions analysts use daily.
  6. Python Strings and String Methods: Slicing, split and stripLearn Python strings with indexing, slicing and the string methods analysts use to clean names, cities, phone numbers and product codes in real data.
  7. Python String Formatting with f-strings: Decimals, Commas, %Format numbers, percentages, rupees, dates and aligned report tables with Python f-strings, plus the format spec mini-language and lakh-style commas.

03Python Flow Control

  1. Python if...else Statement: if, elif, else with ExamplesLearn Python if, if-else and if-elif-else with flowcharts and runnable examples: conditions, indentation, nested if, one-line if-else and beginner traps.
  2. Python for Loop: range(), enumerate(), zip() with ExamplesLearn the Python for loop step by step: looping over lists and strings, range(), running totals, enumerate(), zip(), nested loops and the mistakes to avoid.
  3. Python while Loop: Syntax, break, else and Infinite LoopsLearn the Python while loop with flowcharts and runnable examples: counters, break and while-else, avoiding infinite loops, and when to use for instead.
  4. Python break, continue and pass Statements with ExamplesLearn when to use break, continue and pass in Python loops, with flow diagrams, for-else searches, nested loops and data-cleaning examples you can run.
  5. Python match-case Statement: Structural Pattern MatchingLearn Python match-case (3.10+): literal, OR, capture, sequence and dictionary patterns, guards and the wildcard, with examples that route real data records.

04Python Data Structures

  1. Python Lists: Create, Index, Slice and Modify (with Examples)Learn Python lists step by step: indexing, slicing, append, extend, insert, pop and remove, copying without surprises, and nested lists for table-like data.
  2. Python Tuples: Immutable Sequences, Unpacking and Use CasesLearn Python tuples: creating them, immutability, unpacking and star unpacking, tuple keys for grouped totals, and when to pick a tuple over a list.
  3. Python Sets: Union, Intersection, Difference and Fast LookupsLearn Python sets with sales examples: removing duplicates, add and discard, union, intersection and difference, fast membership tests and frozenset.
  4. Python Dictionaries: Keys, Values, get(), Loops and GroupingLearn Python dictionaries with sales data: create and update dicts, get() vs [], loop with items(), count and group rows, merge with |, and nest records.
  5. Python List Comprehension: Syntax, if-else, Dict and Set FormsLearn Python list comprehension step by step: map and filter in one line, if-else inside, dict and set comprehensions, nested loops and when to use a loop.
  6. Sorting in Python: sorted() vs sort(), key Functions and RanksLearn sorting in Python with sales data: sorted() vs list.sort(), reverse, key functions, sorting dicts by value, multi-column sorts and stable sorting.
  7. Python collections Module: Counter, defaultdict and dequeLearn the Python collections module with analyst examples: Counter for counts, defaultdict for grouping, namedtuple records, deque windows and ChainMap.

05Python Functions and Modules

  1. Python Functions: def, return, Docstrings and Reusable CodeLearn Python functions from scratch: define with def, call them, return values instead of printing, return several results, write docstrings and test helpers.
  2. Python Function Arguments: Positional, Keyword and DefaultLearn Python function arguments: positional vs keyword, default values, the mutable default trap, keyword-only and positional-only parameters, with examples.
  3. Python *args and **kwargs: Packing, Unpacking and ForwardingLearn Python *args and **kwargs: collect any number of arguments, unpack lists and dicts into calls, forward options to other functions, and order parameters.
  4. Python Lambda Functions: Syntax, map, filter and pandas applyLearn Python lambda functions: one-line syntax, lambda vs def, using lambdas as sort keys, with map and filter, in pandas apply, and the late-binding loop trap.
  5. Python Recursion: Base Case, Call Stack and Nested DataLearn Python recursion step by step: base case and recursive case, how the call stack works, summing nested sales trees, recursion limits and caching results.
  6. Python Variable Scope: LEGB Rule, global and nonlocal ExplainedLearn Python variable scope with the LEGB rule: local, enclosing, global and built-in names, the global and nonlocal keywords, and the UnboundLocalError trap.
  7. Python Modules and Imports: import, from, as and __name__Learn Python modules and imports: import, from-import and aliases, writing your own module, how sys.path finds files, the __name__ guard and stdlib modules.
  8. Python Packages: __init__.py, Subpackages and Relative ImportsLearn Python packages: how a folder of modules becomes a package, what __init__.py does, dotted and relative imports, __all__, and a clean project layout.
  9. Python Type Hints: Annotations, list[int], Optional and mypyLearn Python type hints for 3.12+: annotate variables and functions, list[str] and dict[str, float], X | None, TypedDict, type aliases and checking with mypy.

06Python Files and Errors

  1. Python File Handling: open(), Read, Write, Append and withLearn Python file handling: open() modes r, w, a and x, the with statement, reading line by line, writing and appending, encodings, pathlib and StringIO.
  2. Python CSV: Read and Write CSV Files with csv and DictReaderLearn to read and write CSV files in Python: csv.reader and writer, DictReader and DictWriter, quoted commas, newline='', Excel's utf-8-sig and pandas read_csv.
  3. Python JSON: loads, dumps, Files and Nested Data ExplainedWork with JSON in Python: json.loads and json.dumps, reading and writing JSON files, type mapping, Hindi text, dates, nested API data and pandas json_normalize.
  4. Python Exception Handling: try, except, else, finally and raiseLearn Python exception handling: try and except, catching specific errors, else and finally, raising errors, the exception hierarchy and messy data rows.
  5. Python Custom Exceptions: Create Your Own Exception ClassesLearn Python custom exceptions: define your own error classes, build a hierarchy, add fields like row and column, chain errors and report bad data rows.

07Python OOP

  1. Python Classes and Objects: __init__, self, Attributes, MethodsLearn Python classes and objects: the class keyword, __init__ and self, instance vs class attributes, methods, __repr__ and classmethod, with sales examples.
  2. Python Inheritance: Parent and Child Classes, super() and MROLearn Python inheritance: parent and child classes, method overriding, super(), multilevel and multiple inheritance, MRO, mixins and composition.
  3. Python Polymorphism: Duck Typing, Method Overriding and ABCsLearn Python polymorphism: one interface for many classes, method overriding, duck typing, abstract base classes, Protocol and singledispatch, with examples.
  4. Python Operator Overloading: Magic Methods __add__ and __eq__Learn Python operator overloading with magic methods: __add__, __radd__, __eq__, __lt__, __len__, __getitem__, __str__ and __repr__, using a Money class.
  5. Python Dataclasses: @dataclass, field(), frozen and __post_init__Learn Python dataclasses: @dataclass, default values, field(default_factory), __post_init__ validation, frozen and order options, asdict and pandas.

08Advanced Python

  1. Python Iterators: iter(), next() and the Iterator ProtocolLearn Python iterators: iterable vs iterator, iter() and next(), StopIteration, how for loops work, custom __iter__ and __next__, exhaustion and itertools.
  2. Python Generators: yield, Generator Expressions and PipelinesLearn Python generators: how yield pauses a function, generator expressions, memory savings, lazy data pipelines, yield from and infinite sequences.
  3. Python Closures: Nested Functions, nonlocal and FactoriesLearn Python closures: nested functions that remember outer variables, __closure__ cells, nonlocal state, function factories and the late-binding loop trap.
  4. Python Decorators: @ Syntax, functools.wraps and Real ExamplesLearn Python decorators step by step: functions that wrap functions, the @ syntax, functools.wraps, decorators with arguments, stacking, and lru_cache.
  5. Python Regex Tutorial: The re Module with Practical ExamplesLearn Python regular expressions with the re module: search, findall, sub, groups, named groups, greedy vs lazy, flags and regex in pandas, with real data.
  6. Python datetime Tutorial: strftime, timedelta and Time ZonesLearn the Python datetime module: date, time, datetime and timedelta, strftime and strptime format codes, date maths, IST time zones and pandas dates.
  7. Python random Module: randint, choice, shuffle, seed and MoreLearn the Python random module: random(), randint, choice, choices, sample, shuffle and seed, Monte Carlo simulation, fake test data, secrets and numpy.

09Python Career

  1. Python Projects for Beginners: 10 Ideas with Starter Code10 Python projects for beginners, from a guessing game to a pandas sales report, each with a step-by-step outline and runnable starter code to build on.
  2. Python Interview Questions: 25 Answers with Runnable Code25 Python interview questions with short worked answers and runnable code: mutability, copies, scope, decorators, generators, OOP, errors and coding rounds.
Practise on Debugshala TestOnline compiler, coding questions, aptitude and reasoning MCQs. Free at test.debugshala.com ↗