BashaByte

Core Python

  • Beginner level
  • 12 weeks
  • 4 modules
  • 28 lessons
  • 28 h 45 min of material

Overview

About this course

The student reads a problem, plans it, and writes a tested, well-structured Python program using functions, built-in data structures, files, classes and Git. This course is the gateway to every other Python category.

What you'll be able to do

  1. Plan before coding

    Read a problem and plan the solution with an algorithm, flowchart or pseudocode before writing code.

  2. Write correct basic programs

    Write correct programs using variables, data types, input/output, operators, conditions and loops.

  3. Solve problems with functions and data structures

    Break programs into functions and solve LeetCode-easy problems with strings, lists, tuples, sets and dictionaries.

  4. Debug and test

    Find bugs with a debugger, handle errors with exceptions, and prove code works with pytest tests.

  5. Work like a developer

    Save and load data with files, CSV and JSON; organise code into modules; manage packages with pip and venv; and publish work on GitHub.

  6. Design with objects

    Model real systems with classes and objects, and deliver an original, tested capstone project with a README and demo video.

How each lesson works

  1. WatchA short concept video
  2. ReadNotes worth keeping
  3. PredictGuess what code prints
  4. TryRun code in the compiler
  5. CheckA quick quiz
  6. BuildReal coding tasks

Introduction

Introduction: Why Python

4 lessons 1 h 40 min

Before writing a single line of code, meet the language: why Guido van Rossum built it, who keeps it alive today, how widely it is used, and exactly what you will be able to do by the end of this course.

  1. Lesson 0.1Preview

    The story of Python

    30 min

    Guido van Rossum, ABC and Amoeba at CWI; the Christmas 1989 hobby project; the name; first release in 1991; design choices (readability, indentation, extensibility); Python 2 to 3; from BDFL to Steering Council; the Zen of Python.

    ShowHide the 5 steps
    1. Notes Why this lesson matters
    2. Concept video Story video: How Python was born

      Hook · The problem: ABC · Amoeba · Python is born · Design choices · Growth and today

    3. Notes Notes: the story of Python

      The problem Guido faced · The Christmas project · Design choices you will use every day · Timeline · The Zen of Python · Sources

    4. Try it Try it: the Zen of Python
    5. Quick check Quick check: the story of Python

      4 questions

  2. Lesson 0.2Preview

    Who builds Python today

    25 min

    Open source and CPython; core developers; PEPs and the Steering Council; the Python Software Foundation; companies that fund and staff Python development.

    ShowHide the 4 steps
    1. Notes Why this lesson matters
    2. Concept video Video: Who keeps Python running

      Hook · Open source and CPython · How decisions are made · The PSF · Companies behind Python · Close

    3. Notes Notes: who builds Python

      Python is open source · How decisions are made · Companies that support Python · Why companies invest · Sources

    4. Quick check Quick check: who builds Python

      4 questions

  3. Lesson 0.3Preview

    Python in the world today

    25 min

    How popularity is measured (TIOBE, Stack Overflow survey, GitHub Octoverse, PYPL); where Python ranks in 2026; where Python is used; where it is not the best choice.

    ShowHide the 4 steps
    1. Notes Why this lesson matters
    2. Concept video Video: Python in 2026, by the numbers

      Hook · Four ways to measure · Where Python is used · Where it is not · Close

    3. Notes Notes: Python in the world today

      There is no single "market share" · Where Python is used · Where Python is not the best choice · India and Python · Sources

    4. Quick check Quick check: Python in the world

      4 questions

  4. Lesson 0.4Preview

    Your course roadmap and outcomes

    20 min

    The six course outcomes; the 12-module roadmap; how every lesson works; exams, capstone and certificate; AI policy; placement test; what comes after Core Python.

    ShowHide the 4 steps
    1. Concept video Video: Your journey through Core Python

      Welcome · Course outcomes · Roadmap · How lessons work · Study tips

    2. Notes Notes: course outcomes and roadmap

      What you will be able to do · Roadmap · How every lesson works · Rules · Study tips · After Core Python

    3. Notes Set your goal
    4. Quick check Quick check: course rules

      3 questions

Module 1

Getting Started: How Programs Run

6 lessons 6 h 35 min

By the end of this module you will run your own Python programs from the terminal, understand what happens inside the computer when a program runs, and plan a program before you write it.

  1. Lesson 1.1Preview

    What is programming?

    60 min

    Computer basics (CPU, memory, input and output) in 5 minutes; what a program is; what a programming language is; how this course works.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Your first program: just press Run
    3. Concept video Concept video: What is programming?

      You just ran your first program · What a computer does · What a program is · Why programming languages · How every lesson works · Recap

    4. Notes Notes: computers, programs and languages

      What a computer does · What is a program? · Why do we need programming languages? · How this course works · Common mistakes · Key words

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: Hello World!

    7. Try it Try it: run and change
    8. Arrange the code Arrange the code: ATM withdrawal
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug

      Fix the welcome message

    11. Coding task Hello, World!
    12. Coding task Welcome banner
    13. Coding task Input, process, output of a calculator
  2. Locked

    Lesson 1.2

    Types of programming languages

    60 min

    Low-level vs high-level; generations of languages; compiled vs interpreted (and the bytecode middle path); static vs dynamic typing; programming paradigms; where Python fits.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a name that changes its type
    3. Concept video Concept video: Types of programming languages

      Hook · Levels and generations · Compiled vs interpreted · Static vs dynamic typing · Paradigms · Recap

    4. Notes Notes: types of programming languages

      By level of abstraction · By generation · By how code is run · By typing · By paradigm · By application domain · Python in one line · Common mistakes

    5. Predict the output Predict the output

      2 questions

    6. Try it Try it: dynamic typing in action
    7. Arrange the code Arrange: from low-level to high-level
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      C habits in Python

    10. Coding task Level of each language
    11. Coding task Compiled or interpreted
    12. Coding task Python profile card
    Enroll to open this lesson
  3. Locked

    Lesson 1.3

    Python versions and implementations

    50 min

    Version numbers (major.minor.micro); the yearly October release and 5-year support; Python 3.15 as the current version; why Python 2 code breaks; CPython, PyPy, MicroPython and others; choosing which version to install.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: ask Python its version
    3. Concept video Concept video: Python versions and implementations

      Hook · Version numbers · Release and support · Python 2 vs 3 · Implementations · Which to install

    4. Notes Notes: versions and implementations

      Reading a version number · Release and support cycle · Python 2 vs Python 3 · Implementations · Which version should you install? · Checking your version · Common mistakes · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Try it: which Python am I running?
    7. Arrange the code Arrange: Python's version history
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      2

    10. Coding task Parts of a version
    11. Coding task Implementations card
    12. Coding task Support timeline for 3.15
    Enroll to open this lesson
  4. Locked

    Lesson 1.4

    Setup, terminal and first program

    75 min

    BashaByte compiler; installing Python on Windows, macOS and Linux; checking the version; VS Code and the Python extension; terminal basics (pwd, cd, ls/dir, mkdir); the REPL; creating and running hello.py.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: your program, in the browser
    3. Concept video Concept video: setup, terminal and first program

      Hook · Install Python · Check the version · VS Code · Terminal basics · The REPL · First file · Common errors

    4. Notes Notes: setup, terminal and first program

      Install Python · Install VS Code · Terminal basics · The REPL: try code instantly · Your first file · Common errors and fixes · Sources

    5. Predict the output Predict what you will see

      2 questions

    6. Try it Try it: your first file, on your own computer
    7. Arrange the code Arrange the terminal commands
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Mismatched quotes

    10. Coding task Setup check
    11. Coding task Terminal cheat sheet
    12. Coding task Show a REPL session
    Enroll to open this lesson
  5. Locked

    Lesson 1.5

    How Python runs your code

    75 min

    Source code to bytecode to the Python Virtual Machine; compiler vs interpreter vs assembler; .pyc files; print() with many values, sep and end; comments; reading SyntaxError, NameError and IndentationError.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: two lines, then a crash
    3. Concept video Concept video: how Python runs your code

      Hook · Three stages · Compiler vs interpreter vs assembler · Proof with errors · print in depth · Comments · Reading a traceback

    4. Notes Notes: how Python runs your code

      Three stages · Compiler vs interpreter vs assembler · Proof: two kinds of errors · print() in depth · Comments · Reading an error (traceback) · Common mistakes

    5. Predict the output Predict the output

      2 questions

    6. Try it Try it: bytecode and print()
    7. Arrange the code Arrange the code: one-line receipt
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Missing comma

    10. Coding task Date with separator
    11. Coding task Loading message
    12. Coding task Address in one print
    Enroll to open this lesson
  6. Locked

    Lesson 1.6

    Thinking like a programmer

    75 min

    Algorithms and their properties; input, process, output; flowchart symbols; pseudocode; dry runs with trace tables; from problem statement to plan.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: the magic swap
    3. Concept video Concept video: thinking like a programmer

      Hook · Problem to plan · Pseudocode · Flowcharts · Trace tables · Recap

    4. Notes Notes: thinking like a programmer

      Five steps to solve any problem · Algorithm · Pseudocode · Flowcharts · Python can calculate · Dry run with a trace table · Common mistakes

    5. Predict the output Predict the output (dry run first)

      2 questions

    6. Try it Try it: trace, then run
    7. Arrange the code Arrange the algorithm: GST bill
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug: wrong order

      Bill lines in the wrong order

    10. Coding task Area of a rectangle
    11. Coding task Average of three marks
    12. Coding task Kilometres to metres
    Enroll to open this lesson

This module ends with a hands-on mini-project.

Module 2

Variables, Data Types and Input/Output

6 lessons 7 h 15 min

In this module you learn how Python remembers things and talks to people: variables as stickers on objects, the different kinds of data, taking input from a user, and printing neat, professional output.

  1. Locked

    Lesson 2.1

    Variables: stickers on objects

    75 min

    Why variables exist; the water-bottle and stickers story; variables as names that refer to objects; everything is an object; = as assignment; many names for one object and moving a name, checked with id(); naming rules, keywords and PEP 8 style.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: guess, then run
    3. Concept video Concept video: variables are stickers

      The shop bill problem · The water-bottle story · Mapping to Python · Many stickers, one bottle · Moving a sticker · x = x + 1 · Naming rules and style · Recap

    4. Notes Notes: variables are stickers on objects

      What is a variable? · The water-bottle story · The same idea in Python · The shop problem, solved · = does not mean "equal to" · Many stickers, one bottle: check it yourself · Moving a sticker · Naming rules (must follow) · Naming style (should follow) · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: watch the stickers with id()
    7. Arrange the code Arrange the code: bill with variables
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Wrong sticker name

    10. Coding task Price changed to 500
    11. Coding task Student profile sentence
    12. Coding task Batsman's score
    Enroll to open this lesson
  2. Locked

    Lesson 2.2

    Dynamic typing and the data type family

    70 min

    Static vs dynamic typing (the Blinkit example); type(); why Python is still strict about mixing types; the full family of built-in types by category; bool and None.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: Python knows every type
    3. Concept video Concept video: Python picks the container

      Who picks the bottle? · Static typing · Dynamic typing · Strong typing · The data type family · bool and None · Phone number puzzle

    4. Notes Notes: dynamic typing and the data type family

      The old way: you carry the right container · The Python way: Blinkit · type(): ask what container Python used · Flexible, but not careless · The data type family · bool: True and False · None: "nothing yet" · Choosing the right type for real data · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: ask Python about types
    7. Arrange the code Arrange the code: one of each type
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Text plus number

    10. Coding task What type is it?
    11. Coding task Student record with the right types
    12. Coding task Attendance counter with booleans
    Enroll to open this lesson
  3. Locked

    Lesson 2.3

    Integers and number systems

    75 min

    int and its unlimited size; underscores in big numbers; binary, octal and hexadecimal; bin(), oct(), hex() and int(x, base).

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: three strange 13s
    3. Concept video Concept video: integers and number systems

      The orange button · int has no limit · Lakhs with underscores · The leading zero trap · Number systems by hand · bin, oct, hex and int · Where you will use them

    4. Notes Notes: integers and number systems

      int: whole numbers of any size · Writing big numbers readably · The leading zero trap · Number systems · Converting by hand (aptitude favourite) · Let Python do it · Decode BashaByte's orange · Where you will meet these · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: numbers in different clothes
    7. Arrange the code Arrange: 13 to binary by hand
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Wrong base

    10. Coding task 25 in three systems
    11. Coding task Decode BashaByte orange
    12. Coding task Binary message
    Enroll to open this lesson
  4. Locked

    Lesson 2.4

    Floats and complex numbers

    60 min

    float; why 0.1 + 0.2 is not exactly 0.3; round(); scientific notation; complex numbers and where they are used.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: is Python's maths broken?
    3. Concept video Concept video: floats, rounding and complex numbers

      0.1 + 0.2 surprise · What is a float · Why decimals are not exact · Rounding and banker's rounding · Money in real apps · Scientific notation · Complex numbers · Recap

    4. Notes Notes: floats and complex numbers

      float: numbers with a decimal point · The 0.1 + 0.2 surprise · round(): neat numbers for display · Money in real apps · Scientific notation · complex numbers · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: floats under the microscope
    7. Arrange the code Arrange the code: a bill with GST
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug: rupees and paise

      Lost paise

    10. Coding task Petrol bill
    11. Coding task Numbers from science
    12. Coding task Complex number toolkit
    Enroll to open this lesson
  5. Locked

    Lesson 2.5

    Strings and taking input

    80 min

    str with single, double and triple quotes; escape characters; len(); ord() and chr(); input() always returns a string; converting with int() and float(); ValueError.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: 55 or 10?
    3. Concept video Concept video: strings and input

      The 55 trap · Strings first look · input() · Converting types · Two values on one line · Recap

    4. Notes Notes: strings and taking input

      Strings: first look · len() and indexing · Characters are numbers: ord() and chr() · input(): your program listens · Converting types (explicit conversion) · Implicit conversion · bool(): truthy and falsy · Two values on one line: split() · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: make your program listen
    7. Arrange the code Arrange the code: area calculator
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Age next year

    10. Coding task Welcome message
    11. Coding task Simple interest
    12. Coding task Two numbers on one line
    Enroll to open this lesson
  6. Locked

    Lesson 2.6

    Formatting output with f-strings

    75 min

    f-strings; format specs (.2f, width, alignment, thousands separator); printing receipts and tables; module mini-project.

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a bill that looks professional
    3. Concept video Concept video: f-strings, the wedding card printer

      The ugly bill · Wedding card template · Maths inside the blanks · Decimals, width, alignment · Commas and percentages · The debugging trick · Older styles · Recap

    4. Notes Notes: f-strings

      The wedding card printer · Maths inside the blanks · Format specs: put a colon inside the blank · A bill that looks professional · Two honest notes · Senior tip: the debugging trick · Older styles you will see in old projects · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: design your own bill
    7. Arrange the code Arrange the code: restaurant bill
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug: the printer is switched off

      Printer switched off

    10. Coding task Percentage calculator
    11. Coding task One aligned bill row
    12. Coding task Big amounts with commas
    Enroll to open this lesson

This module ends with a hands-on mini-project.

Module 3

Operators and Expressions

6 lessons 6 h 40 min

Operators are the verbs of programming: add, compare, check, combine. In this module you learn every Python operator through real situations (sharing laddoos, checking eligibility, reading clocks), and you learn to predict the value of any expression before you run it.

  1. Locked

    Lesson 3.1

    Arithmetic operators

    70 min

    #ERROR!

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: 17 laddoos, three answers
    3. Concept video Concept video: the laddoo lesson

      17 laddoos · The easy four · // and % · The negative surprise · Power · math module · Division by zero · Recap

    4. Notes Notes: arithmetic operators

      The seven arithmetic operators · // and %: the laddoo operators · The negative surprise · Power: ** · math module basics · Division by zero · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: laddoos, clocks and buses
    7. Arrange the code Arrange the code: minutes to hours
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug: the missing half mark

      The missing half mark

    10. Coding task Sharing laddoos
    11. Coding task Seconds to hours, minutes and seconds
    12. Coding task Booking buses
    Enroll to open this lesson
  2. Locked

    Lesson 3.2

    Comparison and logical operators

    70 min

    #ERROR!

    ShowHide the 12 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: Python answers yes or no
    3. Concept video Concept video: Python starts judging

      Apps ask questions · Comparison operators · Chained comparisons · Strings and floats · and, or, not · The lazy watchman · or for defaults · Recap

    4. Notes Notes: comparison and logical operators

      Comparison operators: asking questions · Chained comparisons · Comparing strings · Never compare floats with == · Logical operators: building rules · Short-circuit: the lazy watchman · Senior tip: or gives a default · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Try it Investigate: be the eligibility officer
    7. Arrange the code Arrange the code: scholarship check
    8. Quick check Quick check

      5 questions

    9. Fix the bug Fix the bug

      Arrow written backwards

    10. Coding task Can vote?
    11. Coding task Scholarship eligibility
    12. Coding task Leap year in one line
    Enroll to open this lesson
  3. Locked

    Lesson 3.3

    Assignment operators

    55 min

    #ERROR!

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a scoreboard and a swap
    3. Concept video Concept video: the scorer's shortcut

      You just ran it · The scorer's shortcut · Two traps · Multiple assignment and swap · a = b = 0 · The walrus · Recap

    4. Notes Notes: assignment operators

      The scorer's shortcut · Stickers again · Two traps · Multiple assignment · The one-line swap · a = b = 0 · The walrus operator := · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: the scoreboard

    7. Try it Investigate: your UPI wallet
    8. Arrange the code Arrange the code: wallet updates
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: the Java habit

      Visitor counter

    11. Coding task UPI wallet
    12. Coding task Exchange seats
    13. Coding task Money that grows
    Enroll to open this lesson
  4. Locked

    Lesson 3.4

    Bitwise and shift operators

    70 min

    & | ^ ~ << >>; seeing numbers in binary; odd/even with & 1; power-of-two check; set, clear and toggle a bit; real uses such as permissions and flags.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: strange answers
    3. Concept video Concept video: thinking in switches

      You just ran it · Rows of switches · AND, OR, XOR, NOT · Shifts · Real uses · Senior tip and recap

    4. Notes Notes: bitwise and shift operators

      Numbers are rows of switches · The four switch operators · Shifts: sliding the switches · Real uses · Senior tip: brackets! · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: last bit

    7. Try it Investigate: play with switches
    8. Arrange the code Arrange the code: file permissions
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: wrong direction

      Wrong direction

    11. Coding task Odd or even with bits
    12. Coding task Power of two in one line
    13. Coding task Bit toggler
    Enroll to open this lesson
  5. Locked

    Lesson 3.5

    Identity, membership and precedence

    65 min

    is vs == (stickers and id()); is None; in and not in with strings; operator precedence and associativity; ** works right to left; brackets for clarity.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: same water, different bottle
    3. Concept video Concept video: same water or same bottle?

      Three puzzles · Same water or same bottle · in and not in · Python's BODMAS · Senior tip and recap

    4. Notes Notes: identity, membership and precedence

      is vs ==: same water, or same bottle? · Use is only for None · in and not in: the attendance register · Precedence: Python's BODMAS · Three surprises · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: negative square

    7. Try it Investigate: bottles, registers and brackets
    8. Arrange the code Arrange the code: attendance register
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: brackets in the wrong place

      Discount in the wrong place

    11. Coding task Vowel checker
    12. Coding task Brackets change everything
    13. Coding task Simple spam filter
    Enroll to open this lesson
  6. Locked

    Lesson 3.6

    Number problems

    70 min

    Last digit, digit sum and reverse of a 3-digit number with // and %; simple and compound interest; nth term of AP and GP; temperature conversion.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: taking a number apart
    3. Concept video Concept video: number magic for placements

      You just ran it · Taking digits apart · Palindrome and Armstrong · The Gauss story · Real formulas · Senior tip and recap

    4. Notes Notes: number problems

      Taking a number apart · Digit sum and reverse · Two placement classics · Sum of 1 to n: the Gauss trick · Real formulas · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: digit sum

    7. Try it Investigate: your number lab
    8. Arrange the code Arrange the code: reverse a number
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: a cold day in Hyderabad?

      Boiling point

    11. Coding task Digit sum and reverse
    12. Coding task Interest calculator
    13. Coding task Auto fare
    Enroll to open this lesson

This module ends with a hands-on mini-project.

Module 4

Control Flow: Making Decisions

6 lessons 6 h 35 min

Until now, Python ran every line, top to bottom, every time. In this module your programs start making decisions: run this block only if a condition is true, choose between two paths, pick one of many options. You'll build real decision programs like grade calculators, electricity bills and ATM menus.

  1. Locked

    Lesson 4.1

    The if statement and indentation

    65 min

    The if statement; conditions and the colon; indented blocks; what happens when the condition is False; truthy conditions; pass; IndentationError and TabError.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a weather advisor
    3. Concept video Concept video: Python learns to decide

      What if it's 25? · The if statement · Indentation: the tiffin box · Three common errors · Truthy conditions and pass · Recap

    4. Notes Notes: the if statement

      The shape of an if · True runs the block, False skips it · Indentation: the tiffin box · Any truthy value works as a condition · pass: an empty box placeholder · Three errors every beginner meets · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: the weather advisor

    7. Try it Investigate: be the weather advisor
    8. Arrange the code Arrange the code: voting reminder
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: the low-balance alert

      Low-balance alert

    11. Coding task Heat alert
    12. Coding task Free delivery
    13. Coding task Student discount
    Enroll to open this lesson
  2. Locked

    Lesson 4.2

    if-else: two paths

    60 min

    else for the other path; exactly one block runs; pass/fail, even/odd and eligibility; common mistakes such as a condition after else.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: odd or even?
    3. Concept video Concept video: the railway junction

      You just ran it · The railway junction · Real two-way decisions · The gap bug · Two classic mistakes · Recap

    4. Notes Notes: if-else

      The railway junction · Real two-way decisions · The gap bug: why not two separate ifs? · Two classic mistakes · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: exactly 35

    7. Try it Investigate: two tracks
    8. Arrange the code Arrange the code: login check
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: else with a condition

      else with a condition

    11. Coding task Pass or fail
    12. Coding task Larger of two
    13. Coding task Even or odd
    Enroll to open this lesson
  3. Locked

    Lesson 4.3

    elif ladders: many choices

    65 min

    elif for many choices; only the first true branch runs; why order matters; grade calculator; slab-based bills.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a grade calculator
    3. Concept video Concept video: the college watchman

      Why only Grade B? · The college watchman · Ladders in real life · The topper who got D · if vs elif · Recap

    4. Notes Notes: elif ladders

      The college watchman · Real ladders · Order matters: the topper who got D · if vs elif inside a ladder · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: two grades

    7. Try it Investigate: be the watchman
    8. Arrange the code Arrange the code: traffic light
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: the 20% that never comes

      The 20% that never comes

    11. Coding task Grade calculator
    12. Coding task Cinema ticket price
    13. Coding task Discount slab
    Enroll to open this lesson
  4. Locked

    Lesson 4.4

    Nested conditions and combining logic

    65 min

    Nested if; when to nest and when to use and/or; guard checks; largest of three numbers; flattening deep nesting.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a mini ATM
    3. Concept video Concept video: the ATM's two gates

      You just ran it · Two gates · Nest or use and? · Arrow code and guard checks · Largest of three · Recap

    4. Notes Notes: nested conditions

      The ATM's two gates · Nest, or use and? · Arrow code and guard checks · Largest of three (placement favourite) · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: the silent ATM

    7. Try it Investigate: test the ATM
    8. Arrange the code Arrange the code: driving check
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: the wrong largest

      The wrong largest

    11. Coding task Mini ATM
    12. Coding task Largest of three
    13. Coding task Driving check
    Enroll to open this lesson
  5. Locked

    Lesson 4.5

    Ternary expressions and match-case

    65 min

    The conditional expression x if condition else y; match-case with values, | for several values and _ as the default; when to use each.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: a one-liner and a phone menu
    3. Concept video Concept video: one-liners and phone menus

      You just ran it · Your mother's one-liners · The customer-care menu · No break needed · Two common mistakes · When to use what

    4. Notes Notes: ternary expressions and match-case

      The ternary: your mother's one-liners · match-case: the customer-care menu · For students who know C or Java · Which tool when? · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: the swapped result

    7. Try it Investigate: build your own IVR
    8. Arrange the code Arrange the code: a phone menu
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: invalid before you even press

      Invalid before you even press

    11. Coding task One-line result
    12. Coding task Customer-care menu
    13. Coding task Weekday or weekend
    Enroll to open this lesson
  6. Locked

    Lesson 4.6

    Decision problems

    75 min

    Electricity bill slabs, triangle type, BMI category, leap year with if, ATM menu; planning decisions with flowcharts and testing boundary values.

    ShowHide the 13 steps
    1. Notes Why this lesson matters
    2. Try it Run it first: an electricity bill
    3. Concept video Concept video: four real decision problems

      Why not 2000? · Plan first · The slab bill · Triangle type · BMI category · Leap year with if · Recap

    4. Notes Notes: decision problems

      Plan first: flowchart and boundary table · The slab electricity bill · Triangle type · BMI category · Leap year with if · Common confusions · Sources

    5. Predict the output Predict the output

      2 questions

    6. Fix the bug Spot the difference

      Spot the difference: the impossible triangle

    7. Try it Investigate: test like a professional
    8. Arrange the code Arrange the code: leap year ladder
    9. Quick check Quick check

      5 questions

    10. Fix the bug Fix the bug: the overcharged customer

      The overcharged customer

    11. Coding task Slab electricity bill
    12. Coding task Triangle type
    13. Coding task BMI category
    Enroll to open this lesson

This module ends with a hands-on mini-project.

Free28 lessons · 28 h 45 min