Digital Technologies · Python Unit

Python Foundations: Project RoboForge

Learn the core building blocks of Python 3.14 — variables, conditionals, loops and lists — then put them together to engineer your own object-oriented robot fleet management system.

Python 3.14 IDLE or online-python.com 6 stages Final task: OOP system
Stage 1

Start Here: Your Mission

By the end of this unit you will design and build RoboForge — a program that manufactures virtual robots as objects, gives each one its own unique specifications, and manages your whole fleet. Every stage teaches you a tool you will need for the final build.

Setup Choose your workshop

Option A — IDLE (school computers)

  1. Open IDLE (Python 3.14) from the Start menu.
  2. The window that opens is the Shell — great for quick experiments.
  3. For real programs, go to File → New File to open the Editor.
  4. Save your file with a .py ending, then press F5 to run it.

Option B — Online (any device)

  1. Go to online-python.com.
  2. Type your code in the editor on the left.
  3. Press the green Run button.
  4. Output and input() prompts appear in the console below.
Shell vs Editor: the Shell runs one line at a time and forgets nothing until you close it. The Editor is where you write full programs you can save and run again. In this unit, always build your tasks in the Editor (or the online editor).

First run Prove your workshop works

Type this into a new editor file and run it:

print("RoboForge systems online.")
name = input("Enter engineer name: ")
print("Welcome to the factory floor, " + name)

Two commands do almost everything at this stage: print() sends text out to the screen, and input() brings text in from the keyboard.

  • SyntaxError — check every bracket ( ) and quote mark " " has a matching partner.
  • Nothing happens — in IDLE, make sure you saved the file and pressed F5 in the editor window, not the Shell.
  • NameError — Python is case-sensitive: Print is not the same as print.
How the tasks count: you will be assessed on your completion of the task at the bottom of each of the first five stages in this module, as well as the major assessment at the end. Completing the basics of every stage task guarantees you a minimum final result of Lower Consolidating — a good safety net, since the final assessment task might be quite tricky for some students. Completing the additional STRETCH components of these tasks will guarantee you a minimum of Upper Consolidating.

Task 1.1 Engineer ID badge

Write a program that asks for your name, your favourite piece of technology, and your engineer call-sign (a nickname), then prints a three-line ID badge using that information.

Stretch: make the badge print inside a border made of = characters.
Stage 2

Variables & Data Types

A variable is a labelled box in the computer's memory. RoboForge will eventually need to store dozens of values — robot names, battery levels, armour ratings — so this stage is your foundation.

Learn Creating variables

robot_name = "VX-9"        # str  — text (a string)
battery = 87                # int  — whole number
top_speed = 14.5            # float — decimal number
is_active = True            # bool — True or False
  • str = string — text data: letters, words and symbols wrapped in quote marks.
  • int = integer — a whole number, positive or negative, with no decimal point.
  • float = floating point value — a number that can hold a decimal point.
  • bool = boolean — a value that can only ever be True or False.

Naming rules for this class: use snake_case (lowercase words joined with underscores), start with a letter, and choose names that describe the value. battery_level beats b every time.

Check a type any time: print(type(top_speed)) tells you what kind of data a variable holds.

Predict What will each snippet print?

Decide your answer before revealing. Then test it in your editor to confirm.

A)

x = 5
y = x + 2
x = 10
print(y)
7. The value of y was calculated when x was 5. Changing x afterwards does not rewind time.

B)

print("10" + "5")
105. These are strings, so + joins them together (concatenation) instead of adding.

C) This one is tricky — you have not been taught it yet, so just have a guess at what you think the answer will be.

print(7 / 2)
print(7 // 2)
3.5 then 3. A single / always gives a float. Double // is floor division — it throws away the remainder.

Learn f-strings: the clean way to print

An f-string lets you drop variables straight into text using curly braces:

robot_name = "VX-9"
battery = 87
print(f"Robot {robot_name} is at {battery}% charge.")

Output: Robot VX-9 is at 87% charge. — you will use f-strings constantly in RoboForge.

Learn input() always gives you a string

Even if the user types 42, input() hands you the text "42". To do maths with it, convert (cast) it first:

battery = int(input("Battery level: "))
battery = battery + 10   # now this works

Use int() for whole numbers and float() for decimals.

Checkpoint quiz — Variables

Answer every question to unlock the assess button.

Task 2.1 Robot spec sheet

Write a program that asks the user for a robot's name (str), weight in kg (float), and year built (int). Then print a spec sheet using f-strings, including the robot's age calculated from the current year.

Stretch: also ask for battery percentage and print how many percentage points it needs to reach a full charge.
Stage 3

Conditional Statements

Conditionals let your program make decisions. A real robot checks its battery before starting a job — your RoboForge robots will do the same.

Learn if, elif, else

battery = int(input("Battery %: "))

if battery >= 80:
    print("Fully operational.")
elif battery >= 30:
    print("Operational — recharge soon.")
else:
    print("Critical! Return to dock.")
  • Python checks conditions top to bottom and runs the first one that is True.
  • The colon : and the 4-space indent are not optional — indentation is how Python knows which lines belong to each branch.
  • elif and else are optional; if can stand alone.

Learn Comparison and logical operators

OperatorMeaningExample (True)
==equal to (two signs — one = assigns!)5 == 5
!=not equal to"on" != "off"
> < >= <=greater / less than (or equal)10 >= 10
andboth sides must be Truebattery > 30 and is_active
orat least one side is Truemode == "eco" or battery > 50
notflips True/Falsenot is_docked

Predict Trace the logic

Decide your answer before revealing. Then test it in your editor to confirm.

A)

score = 70
if score > 50:
    print("Pass")
if score > 60:
    print("Credit")
Both "Pass" and "Credit" print. Two separate if statements are both checked. If the second were elif, only "Pass" would print.

B)

x = 5
if x = 5:
    print("five")
SyntaxError. A single = assigns a value. Comparing needs ==. This is one of the most common bugs in the whole course.

C)

temp = 25
if temp > 20 and temp < 30:
    print("Safe operating range")
"Safe operating range" prints. Both conditions are True. Python even lets you chain it as 20 < temp < 30.

Checkpoint quiz — Conditionals

Answer every question to unlock the assess button.

Task 3.1 Diagnostic scanner

Write a program that asks for a robot's battery % and core temperature. Report:

  • "READY" if battery ≥ 50 and temperature is between 10 and 45
  • "CHARGE FIRST" if only the battery is the problem
  • "COOLING REQUIRED" if only the temperature is the problem
  • "FULL SERVICE" if both fail
Stretch: add an override input — if the user types the correct maintenance code, the robot reports READY regardless.
Stage 4

Loops

Loops repeat code so you don't have to. A factory that builds one robot is a workshop; a factory with a loop is a production line.

Learn for loops and range()

for unit in range(5):
    print(f"Assembling robot unit {unit}")

This prints units 0 to 4 — range(5) gives five numbers starting at 0 and stopping before 5.

CallProduces
range(5)0, 1, 2, 3, 4
range(1, 6)1, 2, 3, 4, 5
range(0, 20, 5)0, 5, 10, 15 (step of 5)
range(10, 0, -1)10, 9, 8 … 1 (counting down)

Learn while loops

A while loop keeps running as long as its condition is True. Perfect when you don't know in advance how many repeats you need — like a charging cycle:

battery = 20
while battery < 100:
    battery = battery + 15
    print(f"Charging... {battery}%")
print("Charge complete.")
Infinite loop warning: if nothing inside the loop ever makes the condition False, the loop never ends. If it happens, press Ctrl+C in IDLE, or Stop on online-python.com. Always ask: what line moves this loop towards finishing?

Learn The accumulator pattern

One of the most useful ideas in programming: start a total at zero, then add to it inside a loop.

total_weight = 0
for unit in range(3):
    weight = float(input("Robot weight (kg): "))
    total_weight = total_weight + weight
print(f"Total cargo: {total_weight} kg")

Predict Trace the loop

Decide your answer before revealing. Then test it in your editor to confirm.

A)

for i in range(3):
    print(i * 2)
0, 2, 4 — one number per line. The loop variable takes values 0, 1, 2 and each gets doubled.

B)

n = 1
while n < 20:
    n = n * 2
    print(n)
2, 4, 8, 16, 32. Yes, 32 prints! The check n < 20 happens at the top of each pass — 16 passes the check, then doubles to 32 before printing.

C)

total = 0
for i in range(1, 5):
    total += i
print(total)
10. The value 10 will print in the output window. The loop adds 1 + 2 + 3 + 4. (total += i is shorthand for total = total + i.)

Checkpoint quiz — Loops

Answer every question to unlock the assess button.

Task 4.1 Launch sequence + production line

Part A: use a for loop with range() to print a countdown from 10 to 1, followed by "LAUNCH".

Part B: ask the user how many robots to build, then use a loop to print a serial number for each one (e.g. RF-001, RF-002 …).

Stretch: use a while loop to keep asking for a maintenance passcode until the user enters the correct one, and count how many attempts they used.
Stage 5

Lists & Arrays

So far each variable holds one value. A list holds a whole collection under one name — exactly what you need to manage a fleet of robots instead of a single machine.

Learn Creating and reading lists

fleet = ["VX-9", "Titan", "Scout-3", "Nova"]

print(fleet[0])      # VX-9  — indexing starts at 0!
print(fleet[3])      # Nova
print(fleet[-1])     # Nova  — negative counts from the end (there is no such thing as -0)
print(len(fleet))    # 4    — how many items
Most common list bug: asking for fleet[4] in a 4-item list causes an IndexError. The last index is always len(fleet) - 1.

Learn Changing lists

CodeWhat it does
fleet.append("Bolt")adds to the end
fleet.insert(0, "Alpha")adds at a position
fleet.remove("Titan")removes the first match by value
fleet.pop()removes (and returns) the last item — or give it a position, e.g. removed_2nd_item = fleet.pop(1)
fleet[1] = "Titan-II"replaces an item
"Nova" in fleetTrue/False membership check
fleet.sort()sorts alphabetically / numerically

Loop through a list with the pattern you already know:

for robot in fleet:
    print(f"{robot} reporting for duty")

Learn Lists vs arrays — what's the difference?

Other languages you may meet later (C#, Java, JavaScript) use arrays: fixed-size collections where every item is usually the same type. Python's list is a more flexible version — it can grow, shrink, and mix types. Python does have a stricter array module and libraries like NumPy for high-performance number crunching, but for this course (and most Python programs), the built-in list is the tool for the job. If an exam or textbook says "array", in Python you can read that as "list".

Predict Trace the list

Decide your answer before revealing. Then test it in your editor to confirm.

A)

nums = [4, 8, 15]
nums.append(16)
print(len(nums))
4. Append added one item, so the length is now 4.

B)

bots = ["A", "B", "C"]
print(bots[len(bots) - 1])
The answer is actually C — the letter C prints in the output window. len(bots) is 3, so this asks for index 2 — the last item. Same result as bots[-1].

C)

total = 0
for n in [10, 20, 5]:
    total += n
print(total)
35. The accumulator pattern works exactly the same when looping over a list.

Checkpoint quiz — Lists

Answer every question to unlock the assess button.

Task 5.1 Fleet roster (mini-RoboForge)

This task rehearses the structure of your final assessment. Build a program with an empty list called fleet and a menu inside a while loop:

=== ROBOFORGE FLEET ROSTER ===
1. Add a robot
2. View all robots
3. Remove a robot
4. Quit
  • Add asks for a name and appends it.
  • View loops through the list and prints each robot with its position number.
  • Remove asks for a name, checks it exists with in, then removes it (or prints an error).
  • Quit ends the loop politely.
Stretch: stop duplicate names being added, and show the fleet count in the menu title each time it prints.
Stage 6 · Main Assessment Task

RoboForge: Fleet Management System

Everything comes together. You will build an object-oriented program that manufactures robots as objects, uses inheritance to create specialised robot types, stores unique parameters for every robot built, and manages the whole fleet in a list.

New tools Classes and objects in five minutes

A class is a blueprint. An object is one real thing built from that blueprint. Your class defines the attributes (data every robot stores) and methods (things every robot can do).

class Robot:
    def __init__(self, name, battery):
        self.name = name          # attributes: each object keeps
        self.battery = battery    # its own copy of these values

    def status(self):              # a method
        return f"{self.name}: {self.battery}% charge"

# Building objects — each has its own unique parameters:
r1 = Robot("VX-9", 87)
r2 = Robot("Nova", 42)
print(r1.status())   # VX-9: 87% charge
print(r2.status())   # Nova: 42% charge
  • __init__ runs automatically whenever an object is created — it is the assembly line.
  • self means "this particular object". self.name is this robot's name.

New tools Inheritance: specialised robots

A child class inherits everything from its parent, then adds or changes what makes it special:

class BattleBot(Robot):                 # inherits from Robot
    def __init__(self, name, battery, armour):
        super().__init__(name, battery)  # run the parent's setup
        self.armour = armour             # new attribute for this type

    def status(self):                     # overriding the parent's method
        return f"{self.name} [ARMOUR {self.armour}]: {self.battery}%"

b1 = BattleBot("Titan", 95, 80)
print(b1.status())   # Titan [ARMOUR 80]: 95%
  • super().__init__() calls the parent's constructor so you don't repeat yourself.
  • Redefining a method in the child is called overriding — the child's version wins.
  • A BattleBot is still a Robot, so it fits in the same fleet list as any other robot.

Brief Your task

Design and build a console program that manages a fleet of robots. Your finished system must:

  1. Define a base class Robot with at least three attributes (e.g. name, battery, weight) and at least two methods (e.g. status(), recharge()).
  2. Define at least two child classes (e.g. BattleBot, ScoutBot, MedicBot) that use super().__init__(), add at least one unique attribute each, and override at least one method.
  3. Let the user manufacture robots through a menu, entering unique parameters for each one — every object in your fleet should hold its own data.
  4. Store every object in a single fleet list, and let the user view the full fleet, search for a robot by name, and remove a robot.
  5. Run the menu in a while loop with input validation (bad menu choices and impossible values are handled without crashing).
Choose your own theme if you prefer. The structure is what matters. Robots, spacecraft, e-sports team roster, drone racing league, PC-build catalogue, game characters — negotiate your theme with your teacher, keeping a base class, two child classes, and unique parameters per object.

Scaffold Starter structure

You may start from this skeleton. The comments are your to-do list — the design decisions are yours.

class Robot:
    def __init__(self, name, battery, weight):
        # store the parameters as attributes
        ...

    def status(self):
        # return a one-line summary string
        ...

    def recharge(self):
        # set battery back to 100 and confirm
        ...

class ScoutBot(Robot):
    def __init__(self, name, battery, weight, sensor_range):
        # call super().__init__ then add sensor_range
        ...

fleet = []

while True:
    print("\n=== ROBOFORGE ===")
    print("1. Manufacture robot")
    print("2. View fleet")
    print("3. Search by name")
    print("4. Remove robot")
    print("5. Quit")
    choice = input("Choose: ")
    # handle each choice — remember input validation!

Milestones Build order & progress tracker

Tick milestones off as you complete them. Work in this order — each step is testable on its own. (Progress resets when the page is closed, so use it within a lesson.)

0 of 8 milestones complete
  • M1 — Base Robot class works: create two robots in code and print both statuses.
  • M2 — First child class inherits with super().__init__() and adds a unique attribute.
  • M3 — Second child class added; at least one method is overridden.
  • M4 — Menu loop runs and quits cleanly.
  • M5 — Manufacture option builds an object from user input and appends it to the fleet list.
  • M6 — View fleet loops the list and calls each object's status().
  • M7 — Search and remove by name both work, including the "not found" case.
  • M8 — Input validation: wrong menu numbers and invalid values are handled without crashing.

Rubric How your work will be assessed

Criterion Developing Consolidating Extending
Classes & objects A base class is defined and at least one object is created with attributes. Base class has multiple attributes and working methods; several objects are created, each storing its own unique parameters. Class design is clean and well-justified; methods return values (not just print); attributes are used consistently through the program.
Inheritance One child class inherits from the base class. Two or more child classes use super().__init__(), add unique attributes, and override at least one method. Inheritance clearly reduces repeated code; overridden methods extend parent behaviour meaningfully; mixed types work seamlessly in one fleet.
Data management (lists) Objects are stored in a list and can be displayed. Fleet list supports add, view, search and remove, using loops and membership checks correctly. Fleet operations handle edge cases (empty fleet, duplicates, missing names) gracefully; output is well-formatted.
Program control & validation A menu loop runs and responds to at least some choices. Menu loop handles every option, quits cleanly, and validates menu input. All user input is validated (including numeric conversions); the program cannot be crashed by ordinary user behaviour.
Code quality Code runs with some meaningful variable names. snake_case naming, sensible structure, and comments explaining key sections. Consistently clear, well-commented code; thoughtful decomposition; f-strings used for all output formatting.
Remember your safety net: you can still achieve a Consolidating result by successfully completing the tasks — and their Stretch extensions — from the bottom of each learning stage. Click any task to jump straight to it.

Submit Submission checklist

  • My .py file runs from a fresh start without errors.
  • My name and class are in a comment at the top of the file.
  • I have tested manufacturing at least one robot of every type.
  • I have tested searching and removing, including a name that does not exist.
  • I have uploaded my file for assessment before the due date.
Restricted

Solutions

This section contains worked solutions for every task, every Stretch extension, and the major assessment. It is locked with a keyword.

Enter the keyword