Autograder demo: Randomized function name

This is a small example question that shows how we can randomize questions using the Python autograder. server.py randomizes a function name and a list of input/output pairs the function must correctly handle, plus a default output for every other case. The test file checks these pairs and the default output.

Design a function named bar that takes a string as input and produces a string as output. For each of the input strings listed in the following table, it should produce the corresponding output:

Input Output
"silly""herring"
"spam""parrot"
"quest""ministry"
"knight""grail"
For any other input, it should produce "hamster".
user_code.py

Correct answer

Student view placeholder

In student views this area is used for assessment and score info.
Tools

Staff information

Question

Title:
Autograder demo: Randomized function name

Variant

Started at:
2026-09-19 08:00:20 (CDT)
Duration:
0s
Show/Hide answer
{}
History
dec frac
rad deg