Hamza Tariq AI tutor portrait for this course

Guided course - 5 chapters

Python basics: A Practical Course with Hamza Tariq

Hamza Tariq teaches Python basics through five practical chapters that move from a clear foundation to guided work, applied decisions, and revision. You will finish with a working program, configuration, or technical walkthrough, a tutor-ready capstone, saved notes, and a repeatable way to continue practicing.

Middle school to early university learners 2 hrs 30 min Practice and checkpoints Free curriculum
Start or resume

Your course progress

0 of 5 chapters complete

0%
0%

Sign in is required to save progress, checkpoint answers, and notes. Sign in to continue.

Next: chapter 1

What you will learn

Build knowledge, use it, and leave with evidence of progress.

  • Explain the essential Python basics vocabulary through a connected mental model.
  • Follow and explain a reliable technical problem solving workflow in guided practice.
  • Apply Python basics to a realistic scenario with visible constraints and tradeoffs.
  • Evaluate and revise a working program, configuration, or technical walkthrough using evidence-based success criteria.
  • Complete a capstone and leave with a specific next-practice plan.

Before you start

  • Comfort using a web browser and basic files
  • No previous programming experience is required unless a chapter says otherwise

Useful materials

  • A laptop or desktop computer
  • A text editor or browser-based coding environment
  • A notes file for test cases and debugging observations

Suggested rhythm

Complete one 30-minute chapter at a time: learn for 10 minutes, practice for 15, then use 5 minutes for the checkpoint and notes.

Course capstone

Working Python basics mini project

Build a focused Python basics solution for a clear user need and show how you tested the important behavior.

What you will submit

  1. A working project or documented configuration
  2. Three test cases with results
  3. A concise README explaining decisions and next improvements

How it will be reviewed

  • Core behavior works as intended
  • The solution is understandable
  • Tests cover likely failures
  • Technical choices are explained

Course chapters

Learn, practice, check, and record what matters.

2 hrs 30 min total
  1. Chapter 1

    Python basics: Foundations and vocabulary

    Build a dependable mental model for Python basics before trying to memorize isolated details. You will define the essential vocabulary, inspect a worked example, and turn the ideas into a reference you can actually use.

    27 min Not complete

    Learning objectives

    • Explain the purpose of Python basics in your own words.
    • Use the chapter vocabulary accurately in a short example.
    • Distinguish a strong example from a common misconception.
    • Create a compact reference for later practice.

    Key terms

    1

    Start with the purpose

    Place Python basics inside a small but realistic software or digital-safety task. Name the result a learner is trying to produce and the constraints that make the skill useful.

    2

    How Python basics actually works

    These are the load-bearing ideas. Everything later in the course is an application of one of them, so it is worth reading slowly and returning to when something stops making sense.

    • Default arguments are evaluated once. A default value is created when the function is defined, not on each call, so a mutable default such as a list persists between calls and quietly accumulates state. The standard fix is to default to None and construct the container inside the function body.
    • Identity is not equality. The == operator compares values, while `is` compares object identity. Python caches small integers and short strings, so `is` sometimes appears to work and the resulting bug is intermittent; reserve `is` for None, True and False.
    • Dictionaries preserve insertion order. Since Python 3.7 the language guarantees that dicts iterate in insertion order, a behaviour that was only an implementation detail in 3.6. Sets carry no such guarantee, so never rely on set iteration order being stable.
    3

    Misconceptions worth clearing early

    Each of these is common, understandable, and expensive to leave in place. Recognising them now saves rework later.

    • Modifying a list while iterating over it. The loop appears to visit every element, so removal inside it looks safe. Fix: Iterate over a copy of the list, or build a new list with a comprehension and rebind the name.
    • Catching bare except. It looks like a way to make code robust against every possible failure. Fix: A bare except also swallows keyboard interrupts and exit calls. Catch Exception, or better, the specific error class you expect.
    • Changing several things at once when something breaks. It feels faster than testing one change at a time. Fix: Change one thing, observe, and revert it if the behaviour does not move; keep the loop small.
    4

    Build the mental model

    Connect the key terms as a process rather than a word list. Use this sequence: decompose the problem, build one testable step, inspect the result, and debug deliberately.

    5

    Catch the common miss

    Compare a surface-level attempt with one that shows correct behavior, readable structure, useful tests, and an explained decision. Explain the single difference that matters most.

    CHAPTER 1 OF 5 · FOUNDATIONSPython basicsLeaves you with a working program, configuration, or techni…COURSE PROGRESSinputlogicstateKEY TERMS
    Visual model

    Python basics at a glance

    Python basics at a glance Use this map to connect the purpose, vocabulary, example, and quality check before memorizing details. 1 Purpose 2 Key ideas 3 Example 4 Check

    Use this map to connect the purpose, vocabulary, example, and quality check before memorizing details.

    Python foundations

    Store values and calculate a result

    Python Read-only example
    scores = [72, 88, 91]
    average = sum(scores) / len(scores)
    
    print(f"Average: {average:.1f}")
    1 / 3
    Create the list scores = [72, 88, 91]

    Python allocates one list holding three numbers and points the name scores at it.

    Scrub through the steps and watch the memory panel: the entire point of each line is what it does to the data.

    Side-by-side comparison

    Two programs that both "work"

    Both attempts look plausible from a distance. Toggle the highlights and study where they part ways.

    Aspect Fragile script Dependable program
    Behavior Right answer for the one input tried so far Right answer for normal, empty, and extreme inputs
    Readability Single-letter names; the intent lives in the author's head Names describe the data; the next reader needs no tour guide
    Failure Crashes or returns nonsense on an empty list Guards the edge case and proves it with a test

    The difference is invisible on the happy path and decisive everywhere else.

    Practice round

    Match the Python basics vocabulary

    Tap a term, then the definition it belongs to. Wrong guesses cost nothing but honesty.

    Retrieval beats rereading: pulling a definition from memory strengthens it far more than recognizing it on the page.

    • Clear the board once, shuffle, and beat your attempt count.
    • Say each definition aloud before tapping — then check yourself.
    Practice activity - 12 min

    Make a one-page field guide

    Create a compact field guide that would help a new learner recognize and begin using Python basics.

    1. Write a one-sentence definition and purpose.
    2. Add the four key terms with a plain-language example.
    3. Include one non-example and explain why it misses.
    4. Finish with a three-step starter checklist.
    Deliverable

    One annotated page or slide that can be reused in later chapters.

    Success looks like
    • The definition is specific.
    • Examples match the vocabulary.
    • The checklist is usable without extra explanation.
    Knowledge check

    Which response best shows a usable foundation in Python basics?

    1 question
    Which response best shows a usable foundation in Python basics?
    Not started

    Sign in to save chapter notes to your account.

    Ready to complete this chapter? Complete the field guide and answer the checkpoint before moving to guided practice.
  2. Chapter 2

    JavaScript foundations: Guided demonstration

    Follow a complete JavaScript foundations example from setup to result, pausing at the decisions that experts often make silently. Then repeat the process with support and check your work against visible criteria.

    29 min Not complete

    Learning objectives

    • Sequence the main steps in a reliable JavaScript foundations workflow.
    • Explain why each important decision is made.
    • Complete a supported example without skipping verification.
    • Use a checklist to identify one correction.

    Key terms

    1

    Watch the whole process

    Trace a model from the initial prompt to a working program, configuration, or technical walkthrough. Mark each point where the learner must observe, choose, or verify rather than act automatically.

    2

    Worked example: Predicting the output order of an event-loop snippet

    Follow each step and predict the next before you read it. Predicting first is what turns a demonstration into practice.

    1. A script logs A, then schedules a timer logging B with zero delay, then a resolved promise logging C, then logs D directly.
    2. The synchronous statements execute first in source order, printing A and then D.
    3. The call stack empties, so the microtask queue drains next and prints C.
    4. Only afterwards does the event loop pick up the timer macrotask and print B, giving the order A, D, C, B.

    A setTimeout of zero does not mean immediately; it means after the current task and after every pending microtask.

    3

    Where this usually goes wrong

    Watch for these while you work through the demonstration rather than afterwards.

    • Expecting an async function to return its value directly. The body reads like ordinary sequential code, so the return looks ordinary too. Fix: An async function always returns a promise. Await the call, or chain a then handler onto it.
    • Losing the value of this when passing a method as a callback. The method reference is handed over without its receiver object attached. Fix: Wrap it in an arrow function or bind the method, since arrow functions take this from the enclosing scope.
    • Changing several things at once when something breaks. It feels faster than testing one change at a time. Fix: Change one thing, observe, and revert it if the behaviour does not move; keep the loop small.
    4

    Practice with scaffolding

    Repeat the model with one detail changed. Keep the prompts visible and say or write the reason for each choice before continuing.

    5

    Check before feedback

    Use correct behavior, readable structure, useful tests, and an explained decision as the quality test. Make one self-correction before asking the tutor to review the result.

    CHAPTER 2 OF 5 · GUIDED DEMOJavaScript foundationsLeaves you with a working program, configuration, or techni…COURSE PROGRESSlogicstatetest caseKEY TERMS
    Guided flowchart

    A complete JavaScript foundations practice run

    Pause at each arrow and explain the decision before moving to the next step.

    Step 1 of 4: Read the task
    Worked JavaScript

    Trace data through a function

    JavaScript Drag any number, or edit the code - it reruns as you change it
    Live output ready

    Two calls, one function: the same recipe transforms different inputs into different strings.

    • Scrub the 3 upward one step at a time — percent moves in jumps of 20. Why 20?
    • Make total 0. What does the output show, and what would you add to guard against it?
    Practice round

    Rebuild the JavaScript foundations method

    The steps of this chapter's method, shuffled. Arrange them so they would actually work.

    A method is a sequence, not a bag of tips — if the order surprises you, that is exactly the gap worth closing now.

    • Order the steps, then explain to yourself why step 2 cannot go last.
    • Shuffle again and solve it in fewer moves.
    Practice activity - 15 min

    Complete the guided run

    Use the chapter workflow to produce a working program, configuration, or technical walkthrough for a slightly changed JavaScript foundations example.

    1. Restate the task and constraints.
    2. Follow the model one decision at a time.
    3. Record the reason for two key choices.
    4. Check the result and revise one issue.
    Deliverable

    A completed guided example with two decision notes and one correction.

    Success looks like
    • The workflow is complete.
    • Decisions have reasons.
    • The final check produces a visible correction.
    Knowledge check

    During guided JavaScript foundations practice, when is the best time to explain a choice?

    1 question
    During guided JavaScript foundations practice, when is the best time to explain a choice?
    Not started

    Sign in to save chapter notes to your account.

    Ready to complete this chapter? Submit the guided example with decision notes, one self-correction, and the checkpoint response.
  3. Chapter 3

    Algebra problem setup: Applied scenario

    Transfer Algebra problem setup into a realistic scenario where the prompt is less tidy and more than one option may be reasonable. You will define the constraints, choose an approach, and defend the tradeoff.

    32 min Not complete

    Learning objectives

    • Extract the relevant facts and constraints from a realistic scenario.
    • Generate at least two plausible approaches to Algebra problem setup.
    • Choose an approach using explicit criteria.
    • Explain the likely consequence of the choice.

    Key terms

    1

    Read the situation

    Translate the scenario into a clear task. Separate facts, assumptions, constraints, and information that is interesting but not relevant to Algebra problem setup.

    2

    Choosing well under real constraints

    Applied work is mostly judgement under limits: less time, less information, and more competing goals than a textbook example allows. These are the decision rules that hold up in practice.

    • Two approaches both look workable: Choose the one you can test more easily; testability compounds faster than elegance.
    • The task feels too large to start: Cut it until one piece can be finished and verified in under an hour, then build outward.
    • You are unsure whether something is a real bug: Write the smallest input that reproduces it; if you cannot reproduce it, you cannot claim to have fixed it.
    3

    Reading the situation before acting

    Before choosing an approach, state three things explicitly: what result the situation actually requires, which constraints are fixed rather than preferences, and what evidence would tell you the approach is working. Skipping this step is the most common reason competent work solves the wrong problem.

    • Default arguments are evaluated once. A default value is created when the function is defined, not on each call, so a mutable default such as a list persists between calls and quietly accumulates state. The standard fix is to default to None and construct the container inside the function body.
    4

    Practitioner notes

    Small pieces of working knowledge that rarely appear in introductory material.

    • Search the standard library before writing a helper. collections.Counter, itertools.groupby and functools.lru_cache replace a surprising amount of hand-rolled code.
    • Use one virtual environment per project and pin your dependencies, so a global package upgrade cannot silently break code that worked yesterday.
    5

    Compare real options

    Generate two workable approaches and test both against the purpose. Do not hide the tradeoff; name what each option improves and what it gives up.

    6

    Make the reasoning visible

    Produce a working program, configuration, or technical walkthrough and attach a short decision note. The note should make the result auditable, not merely confident.

    CHAPTER 3 OF 5 · APPLIED SCENARIOAlgebra problem setupLeaves you with a working program, configuration, or techni…COURSE PROGRESSstatetest casedebuggingKEY TERMS
    Visual model

    From scenario to decision

    From scenario to decision A realistic task becomes manageable when facts and constraints are separated before options are compared. 1 Facts 2 Constraints 3 Options 4 Decision

    A realistic task becomes manageable when facts and constraints are separated before options are compared.

    Practice round

    Match the Algebra problem setup vocabulary

    Tap a term, then the definition it belongs to. Wrong guesses cost nothing but honesty.

    Retrieval beats rereading: pulling a definition from memory strengthens it far more than recognizing it on the page.

    • Clear the board once, shuffle, and beat your attempt count.
    • Say each definition aloud before tapping — then check yourself.
    Practice activity - 18 min

    Solve the scenario

    Apply Algebra problem setup to a scenario from school, work, home, or community life that includes at least two constraints.

    1. Write the task, audience, and constraints.
    2. Sketch two possible approaches.
    3. Choose using three criteria from the chapter.
    4. Produce the result and explain one tradeoff.
    Deliverable

    A scenario response with an option comparison and a short decision note.

    Success looks like
    • Constraints are visible.
    • Both options are plausible.
    • The final choice follows the stated criteria.
    Knowledge check

    What makes an applied Algebra problem setup decision defensible?

    1 question
    What makes an applied Algebra problem setup decision defensible?
    Not started

    Sign in to save chapter notes to your account.

    Ready to complete this chapter? Finish the scenario response, compare two options, and explain the selected tradeoff.
  4. Chapter 4

    Data literacy: Review and improve

    Learn to diagnose and improve Data literacy work with a focused rubric instead of vague judgment. You will separate symptoms from causes, revise the highest-value issue, and document the before-and-after difference.

    30 min Not complete

    Learning objectives

    • Evaluate a draft using explicit Data literacy criteria.
    • Identify the cause behind the most important weakness.
    • Choose a revision with high impact and reasonable effort.
    • Explain how the revision changes the result.

    Key terms

    1

    Use the rubric, not a feeling

    Review the work for correct behavior, readable structure, useful tests, and an explained decision. Record evidence for each judgment so feedback points to something observable.

    2

    Diagnostic checklist

    Run this before you revise anything. Diagnosing first prevents the common failure of polishing the parts that were already fine.

    • Check: Modifying a list while iterating over it — is this present in your work?
    • Check: Catching bare except — is this present in your work?
    • Check: Changing several things at once when something breaks — is this present in your work?
    • Check: Reading code without running it — is this present in your work?
    3

    The quality bar

    This is what finished work looks like in this field. Use it as the standard for your revision rather than a general sense of improvement.

    • The behaviour is correct on ordinary input and on at least one awkward edge case
    • Names describe intent, so the code can be read without the author present
    • There is a concrete way to demonstrate that it works, not just an assurance
    4

    Diagnose before editing

    Name the symptom, then ask what decision or missing step produced it. Choose the cause you can address rather than changing everything at once.

    5

    Revise and compare

    Make one purposeful revision and compare the two versions. Keep the change only if it improves the intended result without creating a larger problem.

    CHAPTER 4 OF 5 · REVIEW & IMPROVEData literacyLeaves you with a working program, configuration, or techni…COURSE PROGRESStest casedebugginginputKEY TERMS
    Data lab

    Let one wild value fight the average

    Drag the ninth value; the mean chases it while the median stands firm.

    The mean listens to every value, the median only to the middle one — which is why one billionaire moves a neighborhood's average income and not its typical one.

    • Drag the outlier to 300 and compare the two centers.
    • When would you report the mean anyway?
    Revision flowchart

    Evidence-led improvement loop

    Revise the cause of the highest-value issue, then compare the new result with the original criteria.

    Step 1 of 4: Inspect evidence
    Data example

    Normalize and filter small records

    Python Read-only example
    rows = [
        {"name": "  Amina " , "score": "84"},
        {"name": "", "score": "missing"},
    ]
    
    clean_rows = [
        {"name": row["name"].strip(), "score": int(row["score"])}
        for row in rows
        if row["name"].strip() and row["score"].isdigit()
    ]
    1 / 9
    Make state explicit rows = [

    A named value is created or updated so later behavior can refer to it.

    The transformation makes whitespace, missing names, and numeric conversion rules explicit.

    Side-by-side comparison

    Two programs that both "work"

    Use this pair as your revision rubric: find which column your current draft sits in, one row at a time.

    Aspect Fragile script Dependable program
    Behavior Right answer for the one input tried so far Right answer for normal, empty, and extreme inputs
    Readability Single-letter names; the intent lives in the author's head Names describe the data; the next reader needs no tour guide
    Failure Crashes or returns nonsense on an empty list Guards the edge case and proves it with a test

    The difference is invisible on the happy path and decisive everywhere else.

    Practice round

    Rebuild the Data literacy method

    The steps of this chapter's method, shuffled. Arrange them so they would actually work.

    A method is a sequence, not a bag of tips — if the order surprises you, that is exactly the gap worth closing now.

    • Order the steps, then explain to yourself why step 2 cannot go last.
    • Shuffle again and solve it in fewer moves.
    Practice activity - 16 min

    Run a focused revision cycle

    Review a previous Data literacy artifact or the supplied flawed example, then improve the most consequential issue.

    1. Score the draft against three criteria.
    2. Quote or point to evidence for the weakest score.
    3. Name the likely cause and revise it.
    4. Write a before-and-after comparison.
    Deliverable

    A marked-up draft, revised version, and four-sentence change note.

    Success looks like
    • Feedback cites evidence.
    • The revision addresses a cause.
    • The comparison explains a measurable or observable improvement.
    Knowledge check

    Which feedback is most useful for improving Data literacy?

    1 question
    Which feedback is most useful for improving Data literacy?
    Not started

    Sign in to save chapter notes to your account.

    Ready to complete this chapter? Document one evidence-based diagnosis, revision, and before-and-after comparison.
  5. Chapter 5

    O/A level and university bridge study: Capstone integration

    Integrate the course methods in a compact O/A level and university bridge study capstone. You will define the brief, plan milestones, produce a complete result, gather tutor feedback, and leave with a repeatable next-practice plan.

    37 min Not complete

    Learning objectives

    • Translate the capstone brief into milestones and checks.
    • Combine the course methods without losing the central purpose.
    • Present evidence for the quality of the final result.
    • Choose the next skill to practice from the final review.

    Key terms

    1

    Define a finishable brief

    Choose a specific audience, result, and boundary for the O/A level and university bridge study capstone. Reduce scope until the project can be finished and reviewed in one focused cycle.

    2

    Bringing the parts together

    A capstone is judged on coherence, not on the number of techniques it includes. Return to the core ideas and make sure the work demonstrates them rather than decorating them.

    • Default arguments are evaluated once. A default value is created when the function is defined, not on each call, so a mutable default such as a list persists between calls and quietly accumulates state. The standard fix is to default to None and construct the container inside the function body.
    • Identity is not equality. The == operator compares values, while `is` compares object identity. Python caches small integers and short strings, so `is` sometimes appears to work and the resulting bug is intermittent; reserve `is` for None, True and False.
    • Dictionaries preserve insertion order. Since Python 3.7 the language guarantees that dicts iterate in insertion order, a behaviour that was only an implementation detail in 3.6. Sets carry no such guarantee, so never rely on set iteration order being stable.
    3

    Standards that make the work credible

    These are the marks of work that would be taken seriously by someone who does this professionally.

    • The behaviour is correct on ordinary input and on at least one awkward edge case
    • Names describe intent, so the code can be read without the author present
    • There is a concrete way to demonstrate that it works, not just an assurance
    4

    Practitioner notes

    Small pieces of working knowledge that rarely appear in introductory material.

    • Search the standard library before writing a helper. collections.Counter, itertools.groupby and functools.lru_cache replace a surprising amount of hand-rolled code.
    • Use one virtual environment per project and pin your dependencies, so a global package upgrade cannot silently break code that worked yesterday.
    5

    Build with checkpoints

    Plan foundation, first draft, verification, and revision milestones. At each checkpoint, save evidence instead of relying on memory.

    6

    Present and continue

    Present a working program, configuration, or technical walkthrough with a concise rationale. Use the final rubric to choose one strength to retain and one next practice target.

    CHAPTER 5 OF 5 · CAPSTONEO/A level and universitybridge studyLeaves you with a working program, configuration, or techni…COURSE PROGRESSdebugginginputlogicKEY TERMS
    Visual model

    Capstone learning loop

    Capstone learning loop The capstone is a complete cycle: define a finishable brief, build, review evidence, then choose the next practice target. 1 Brief 2 Build 3 Review 4 Continue

    The capstone is a complete cycle: define a finishable brief, build, review evidence, then choose the next practice target.

    Practice round

    Match the O/A level and university bridge study vocabulary

    Tap a term, then the definition it belongs to. Wrong guesses cost nothing but honesty.

    Retrieval beats rereading: pulling a definition from memory strengthens it far more than recognizing it on the page.

    • Clear the board once, shuffle, and beat your attempt count.
    • Say each definition aloud before tapping — then check yourself.
    Practice activity - 22 min

    Complete the capstone sprint

    Create a complete O/A level and university bridge study artifact for a defined audience and purpose, using the course rubric to review it.

    1. Write a brief with scope and success criteria.
    2. Create the first complete version.
    3. Run a self-check and request focused tutor feedback.
    4. Revise, present, and set one next-practice target.
    Deliverable

    A finished capstone, evidence of one revision, and a next-practice note.

    Success looks like
    • The result answers the brief.
    • Course methods are visible.
    • Revision follows feedback or evidence.
    • The next step is specific and achievable.
    Knowledge check

    When is the O/A level and university bridge study capstone ready to finish?

    1 question
    When is the O/A level and university bridge study capstone ready to finish?
    Not started

    Sign in to save chapter notes to your account.

    Ready to complete this chapter? Submit the completed capstone, revision evidence, rubric review, and one concrete next-practice target.

Make it personal

Turn the public curriculum into your own learning path.

Ask Hamza Tariq to adapt the sequence to your level, available time, and goal. The personalized path can then be saved in your workspace.