Rullst AcademyRullst Academy/Lesson
Python: from first line to project · Lesson 12 / 12

Your small-mission organiser

Time to bring the pieces together: data, decisions, loops, functions, files and tests. Your program chooses fictional missions that fit the available time.

Learning paths18 min

Let's discover together

  1. 1

    The rule visits the list in order. It skips completed missions and accepts an unfinished one if its duration fits the remaining time. It then subtracts that duration. An oversized mission is skipped; the loop continues.

  2. 2

    Tico uses 10 minutes, Luma 20 and Nilo 15, but Nilo is already complete. With limit 30, Tico and Luma fit: total 30, remainder 0. With 25, only Tico fits: total 10, remainder 15.

  3. 3

    The example is the core rule with prepared data. The downloadable project adds validation, missions.json, a report and tests. Extract every file, run organizer.py, then python -m unittest -v (python3 on macOS/Ubuntu).

  4. 4

    Order matters: with Luma before Tico and limit 25, Luma is selected. This rule does not seek the best possible combination. Revise the order, test and explain your decision; a useful program must state its behaviour and what it does not consider.

  5. 5

    The Rullst Academy editor saves one file per upload; the ZIP contains the complete starter project. To publish all files, extract it and follow PUBLISH.md. The program sends nothing to the internet. --save creates report.txt and refuses to overwrite an existing report.

  6. 6

    This path uses only the standard library. For future projects with external packages, use one virtual environment per project: it separates package installations but does not make unknown code safe. Consult the venv guide before installing; do not use sudo pip or publish the .venv folder.

FROM LESSON TO PRACTICE

A guide to follow at your pace

Read the steps before using the reference below. Commands run in the indicated system’s terminal; signup happens on the official site. Rullst Academy exercises are practice and do not verify your installation or external account.

def plan(tasks, budget):
    selected = []
    remaining = budget
    for task in tasks:
        if not task["done"] and task["minutes"] <= remaining:
            selected.append(task["title"])
            remaining -= task["minutes"]
    return selected, budget - remaining, remaining

tasks = [{"title": "Tico", "minutes": 10, "done": False},
         {"title": "Luma", "minutes": 20, "done": False},
         {"title": "Nilo", "minutes": 15, "done": True}]
print(plan(tasks, 30))

Official links and next step

✦
YOUR MISSION

Run, modify and test a local project; explain its selection rule and limitations.

Now it's your turn

Discovery workshop

Read, predict, check

Compare the two versions. Show result reveals a prepared output: this panel does not run Python. Then practise with the activity file.
Mini experiment

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

def plan(tasks, budget):
    selected = []
    remaining = budget
    for task in tasks:
        if not task["done"] and task["minutes"] <= remaining:
            selected.append(task["title"])
            remaining -= task["minutes"]
    return selected, budget - remaining, remaining

tasks = [{"title": "Tico", "minutes": 10, "done": False},
         {"title": "Luma", "minutes": 20, "done": False},
         {"title": "Nilo", "minutes": 15, "done": True}]
print(plan(tasks, 30))
Build your answers and check when you are ready.
A moment to understand

Does the rule always choose the combination using the most minutes?

I need a hint

Compare outputs when reversing Tico and Luma with limit 25.

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

Download and run the project. Set the limit to 25, test another order and add a fictional mission. Add a new test and record prediction, output, change and a model limitation. Your written reflection is not automatically graded.

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

Download and run the project. Set the limit to 25, test another order and add a fictional mission. Add a new test and record prediction, output, change and a model limitation. Your written reflection is not automatically graded.

PYTHON · .py

Your Python workbench

Here you read and predict prepared outputs. To run the actual code, download the activity file, edit it on your computer and use Python. Rullst Academy grades lesson answers; it does not verify local execution.

Save and run

Extract the activity ZIP into its own folder. Open a terminal there and use your system’s command. If downloading your edited file separately, use its actual name in the command. Save before running again.

Windows
python organizer.py
macOS / Ubuntu
python3 organizer.py
My files and GitHub

The editor keeps a local draft and can send a .py file to GitHub with your confirmation. Download your edited code to preserve it. The ZIP is starter material; for the final project, also publish data and test files following PUBLISH.md.

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.