NmZlNzI4ZGQxNGRmNDc1MjUxZmIzMGU5MzFmZDg3NTE4MWFjMTJlY2E4OTJhNGQwMTNkYzExNzUyYTRjOTA1OA.mu8c4778.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzEvaW5zdGFuY2VfcXVlc3Rpb24vNTMvIiwiYXV0aG5fdXNlcl9pZCI6IjEifQ
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.1. Demo: Fibonacci function, in-browser editor, external grading

The Fibonacci numbers are 1, 1, 2, 3, 5, 8, ..., where each number is the sum of the two before it. These are numbered $F_1, F_2, \ldots$, and \[ F_n = F_{n-1} + F_{n-2}. \]

Write a Python function fib that takes a number n and returns the nth Fibonacci number, $F_n$.

Your code snippet should define the following variables:

Name Type Description
fib python function Function to compute the $n^\text{th}$ Fibonacci number
user_code.py
Editor Settings

Note: In the above example, the attribute source-file-name='initial_code.py' was used to add existing code to the in-browser file editor from a source file. Another option is omit the source-file-name attribute and instead write the existing code directly inside the html element, between the pl-file-editor tags.

Correct answer

Collection 2

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

Question C2.1

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.

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/codeEditor
Title:
Demo: Fibonacci function, in-browser editor, external grading

Variant

Started at:
2026-09-19 06:59:21 (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.