Rullst AcademyRullst Academy/Lesson
Python on Windows · Lesson 05 / 05

My workshop, ready and tested

Your first project calculates time left in a fictional plan. Four tests help notice when a change breaks the rule.

Learning paths18 min

Let's discover together

  1. 1

    Download the activity and extract it into a new folder. mission.py contains a small function; test_mission.py contains four tests. README.md explains your system’s commands. Do not run inside the ZIP or name your file unittest.py or python.py: that can hide modules with those names.

  2. 2

    def names a reusable rule; total and used receive numbers. return provides the result. max(0, total - used) chooses the larger value: remaining time never becomes negative. Here we use only nonnegative integers; this is not a validator for arbitrary input. The __main__ block prints the example when the file runs directly.

  3. 3

    In the extracted folder’s terminal, run python mission.py: expect 15. Then run python -m unittest -v: four tests should run, ending with OK. Ran 0 tests does not verify the project; check the folder and test_mission.py filename. The tests use unittest, included with Python.

  4. 4

    Keep a copy of mission.py as mission-backup.txt. Change only return max(0, total - used) to return total - used, save and rerun tests: case 20, 25 should fail by returning -5. Restore the original line and confirm all four tests pass. This shows a test catching a real defect.

PYTHON · windows

From the browser to your computer

This page’s predictions use prepared examples. To practise for real, download the activity, extract it into a new folder and follow README.md one step at a time. Rullst Academy does not install or run Python on your computer.

Commands in your system’s terminal

python mission.py
python -m unittest -v

Code to save in the editor

The Python lines below belong in the file. Terminal commands are in the preceding panel. Do not copy >>>, line numbers or Markdown fences.

# For this workshop, total and used are nonnegative integers. Python I will explore functions and validation.
def minutes_left(total, used):
    return max(0, total - used)


if __name__ == "__main__":
    print(minutes_left(20, 5))
Optional step: an environment per project

After finishing, you can create .venv where that name does not already exist. Commands use that folder’s Python directly, without activation or changing PowerShell policy. Do not copy .venv to another computer or publish it; recreate it when needed. No extra package is required here.

python -m venv .venv
.\.venv\Scripts\python.exe mission.py
.\.venv\Scripts\python.exe -m unittest -v
Official links and next step
My files and GitHub

In the first two lessons, the editor keeps .md notes. Afterwards it keeps .py code. Download your edits to take them to another device; the ZIP contains starter material. GitHub publishing is optional and sends one file per operation, without sending your Python environment.

Continue to Python I
✦
YOUR MISSION

Run a program and its tests, cause a failure and fix it.

Now it's your turn

Discovery workshop

Prepare, observe and explain

Prepared scenarios query the same rule with 20 planned minutes: first 5 used, then 25 used. On your computer, the kit also tests the exact limit and a zero-minute plan. Online answers do not prove you ran local tests.
Mini experiment

Learning simulation: compare cards and check your predictions. The browser is not compiling Rust or starting a server.

def minutes_left(total, used):
    return max(0, total - used)

print(minutes_left(20, 5))
Build your answers and check when you are ready.
A moment to understand

Why cause and then fix a test failure?

I need a hint

Compare the tools, the file and the result. You do not need to guess.

Loading your journey…

How can I tell what I learned?

Use the objectives and challenge below for reflection or a conversation with someone who can help. This is guided self-assessment: it sends no answers, awards no XP and does not automatically verify independence.

In Foundations, change an example, predict results, check a normal case and an error case, and explain your choices. If you need help, identify what to practice again.

Your transfer challenge

Create a fifth case, for example 30 planned minutes and 10 used, expecting 20. Run again and check five tests. Record the failure you caused and what you learned; then continue to Python I. Sharing on GitHub is optional.

Keep evidence: prediction, attempt, result, an original change and what you still cannot explain. Seek feedback when possible; if studying alone, return later without copying and compare attempts.

Try again another time

After a break, explain the idea without opening the solution and try a different example. Compare with your first attempt: what can you do independently, and where do you need a hint? You may write, speak or draw; choose a way to check the same idea. Record help received, including AI, and revisit the part you need. There is no universal deadline or extra XP for this record.

Completions and XP record Rullst Academy assessments. An introductory track can help everyday life and prepare further study; alone it does not prove complete mastery or professional readiness. Level indicates depth, not age.

Take it with you

Create a fifth case, for example 30 planned minutes and 10 used, expecting 20. Run again and check five tests. Record the failure you caused and what you learned; then continue to Python I. Sharing on GitHub is optional.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.