MDJjZjIwYjEyYWZjMDU1ZTI5ZWMzOGQ4MWZjOWMzZjRiMjE4MzE4YjRmZTA2ODc1MjQwYzhmMDU4ZTBmNWEyZA.mu8c3yd2.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzEvaW5zdGFuY2VfcXVlc3Rpb24vNzMvIiwiYXV0aG5fdXNlcl9pZCI6IjEifQ
Skip to main content Accessibility guide
PrairieLearn Go home
  • XC 101, SectionA
  • Assessments
  • Gradebook
  • C2
Load from disk
  • Dev User student
    View type
    ✓ Staff view staff ✓ Student view student ✓ Student view without access restrictions student
    Effective user
    Customize…
    Course Requests Settings Log out

Regenerate assessment instance

Warning: Regenerating the assessment instance will select a new set of questions from this assessment. Any progress on the current assessment instance will be lost.

Are you sure you want to regenerate the assessment instance?

Course staff: Regenerate your assessment instance to pick up changes to the assessment or to get a fresh set of questions.

C2.10. 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
Editor Settings

Correct answer

Collection 2

Assessment overview
Total points: 0/68
Score:
0%

Question C2.10

Value: 1
Total points: — /5
Auto-graded question

This form is only for reporting errors in the question itself. Do not use this form if you just don't know how to answer the question.

Previous question Next question

 Personal Notes

No attached notes

Attached files will be saved here for your reference. These files act as personal notes and can be used for your own review purposes. They are not used for grading.

Max file size: 10 MB

Attached personal notes will be saved here for your reference. These notes can be used for your own review purposes. They are not used for grading.

Staff information

Student details

Dev User
dev@example.com

Question

QID:
demo/autograder/python/randomFunctionName
Title:
Autograder demo: Randomized function name

Variant

Started at:
2026-09-19 06:59:09 (CDT)
Duration:
0s
Show/Hide answer
{}

Assessment instance

Assessment:
demo/externalGrading
Started at:
2026-09-18 22:13:44 (CDT)
Duration:
0s
View log
This box is not visible to students.