Skip to content
Fondazione ITS INCOM

Examples · Cloud & Cybersecurity

A tutor that does not give you the answer

A subnetting exercise with a tutor that only asks questions. In the chat, or as a small Python program with gpt-oss-120b, the model that checks the maths.

Beginner · 30 min

The idea

A model that gives you the solution does your homework, and you learn nothing. A model told to ask instead of answer makes you find the solution yourself, one step at a time.

The model

gpt-oss-120b (gpt-oss-120b), the biggest model of the school. It reasons before answering: it is slower, but it is good at the binary maths of subnetting, and at pointing to the step where your mistake is. It can still be wrong: the solution is at the end of this page.

In the chat

Open a new conversation, pick gpt-oss-120b and paste:

You are a patient networking tutor for first-year students. Never give the final answer to an exercise. Ask one question at a time that leads me one step forward. When I give an answer, tell me whether it is right; if it is wrong, point to the step with the mistake, not to the solution.

The exercise: split 192.168.10.0/24 into 6 subnets of the same size. For each one I must find the network address, the broadcast address and the range of usable hosts.

Then answer its questions. Try a wrong answer on purpose and see what it does.

In Python

The same tutor in your terminal. You need a key and the openai library, as in Your first API call in Python.

import os

from openai import OpenAI

client = OpenAI(
    base_url="https://api.ai.itsincom.org/v1",
    api_key=os.environ["API_KEY"],
)

TUTOR = (
    "You are a patient networking tutor for first-year students. Never give the final answer "
    "to an exercise. Ask one question at a time that leads the student one step forward. When "
    "the student answers, say whether it is right; if it is wrong, point to the step with the "
    "mistake, not to the solution."
)

messages = [{"role": "system", "content": TUTOR}]
print("Write the exercise, then answer the tutor. An empty line ends.")

while text := input("> ").strip():
    messages.append({"role": "user", "content": text})
    answer = client.chat.completions.create(model="gpt-oss-120b", messages=messages)
    reply = answer.choices[0].message.content
    messages.append({"role": "assistant", "content": reply})
    print(reply)

The list messages is the memory of the conversation: the model sees all of it every time. Without it, the tutor would forget your previous answers.

Every word counts

Our first version of this tutor ended with “Answer in the student's language”. gpt-oss-120b then answered a question written in English in Spanish, every time. Without that sentence it answers in the language you write in: English to English, Italian to Italian. A prompt is code: change one sentence and test it again.

Exercise

Solution

Six subnets need 3 more bits (2³ = 8 ≥ 6), so the mask is /27: 32 addresses per subnet, 30 usable.

subnet network usable hosts broadcast
1 192.168.10.0/27 .1 – .30 .31
2 192.168.10.32/27 .33 – .62 .63
3 192.168.10.64/27 .65 – .94 .95
4 192.168.10.96/27 .97 – .126 .127
5 192.168.10.128/27 .129 – .158 .159
6 192.168.10.160/27 .161 – .190 .191

Two more /27 subnets, .192 and .224, stay free for later.

All examples