# python-functions

> Write solve(values: list[int]) -> int from a one-line specification; private cases decide the verdict.

Source: https://nodus-platform-site.pages.dev/docs/reference/environments/python-functions/
Build revision: 211ad9f836655b1c3a2668c4693e442471f28614

<!-- Generated by tools/catalogdocs from catalog/objects. Do not edit: run make gen. -->

Write solve(values: list\[int]) -> int from a one-line specification; private cases decide the verdict.

|Field|Value|
|-|-|
|Reference|`nodus/python-functions@1.0.0`|
|Image|`nodus/env-python-functions:1.0.0`|
|Publisher|Nodus|
|Category|Code|
|Readiness|Stable|
|Modes|Train, Evaluate|
|Reward|Binary|
|Held-out measures|TrainedTask|
|Splits|20 train, 16 test (disjoint by canonical identity)|
|Licenses|code Apache-2.0, data Apache-2.0|
|Source|<https://github.com/nodus-compute/nodus-platform/tree/main/images/environments>|

## Grading

Completions are graded by the platform, never by the trainer: the trainer submits `{taskId, completion}` batches and the verdicts come back as task events.

|Grader|Kind|What it checks|
|-|-|-|
|`private-cases`|Program|Runs the candidate as an unprivileged uid on public inputs; every private expected output must match|

Grading runs in a sandbox (`nodus/env-python-functions:1.0.0`, 1 CPU, 1Gi memory, 30s timeout, no network); candidate code runs as an unprivileged user that cannot read the expected answers.

## Sample task

One line of `nodus-env tasks --split test --seed 0`; tasks never carry answers.

```json
{
  "metadata": {
    "function": "count-divisible-by-last"
  },
  "prompt": "Write Python source defining solve(values: list[int]) -\u003e int. Return how many values are divisible by the last value, or 0 when it is zero. Return 0 for an empty list. Output only Python source, without Markdown fences.",
  "taskId": "python-functions:test:0:0"
}
```

## Examples

Each example is a TrainingJob template. A baseline is shown only where the example was measured by running it.

|Example|Mode|Runtime|Model|Tasks|Baseline|Trained|Measured on|
|-|-|-|-|-|-|-|-|
|`python-functions-grpo`|Train|`nodus/grpo-lora`|Qwen/Qwen3-0.6B @ `c1899de`|16|not measured|not measured|not measured|

Run one with a server dry-run first:

Terminal window

```console
$ nodus create trainingjob my-run --from-example nodus/python-functions:python-functions-grpo --dry-run=server -o estimate
```

```python
import nodus

job = nodus.recipes.TrainingJob.from_example("nodus/python-functions:python-functions-grpo")
plan = job.preview()
run = plan.run(max_cost=5)
print(run.wait().summary)
```
