MjIxOTk5ZWQ2ZDIxZmFhYWQ4N2Y5NTM1OTNiNDhlMjJhZjkwOTVmMzM0NmUzZTI0OTU4NmQ1ZjI3YjJhMDZlYg.msfhd8xk.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzIvaW5zdGFuY2VfcXVlc3Rpb24vMjAwLyIsImF1dGhuX3VzZXJfaWQiOiIxIn0
Skip to main content Accessibility guide
PrairieLearn Go home
  • XC 101, SectionA
  • Assessments
  • Gradebook
  • C4
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.

C4.7. Element pl-order-blocks: code with ranking and indentation

This question illustrates the grading-method="ranking" mode of pl-order-blocks, which is useful for Parsons-style coding problems.


Implement the Python function my_sum, which takes 2 numbers, first and second, and returns their sum. Note that the ordering of instantiation, computation, and returning of the value must be correct. Remember to indent your code!

This example uses grading-method="ranking" to control how the correct solution is ordered, the indent attribute in pl-answer to define expected code indentation, and the distractor-for attribute to visually pair blocks with their distractors.

Drag from here:
  • 1
    return sum
    
  • 1
    def my_sum(first, second):
    
  • 1
    sum = 0
    
  • 1
    sum += first
    
  • 1
    sum &= first
    
  • 1
    sum + second
    
  • 1
    sum += second
    
  • 1
    sum + first
    
Construct your solution here:
Additional attempts available with new variants

Correct answer

Collection 4

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

Question C4.7

Value: 2
All variants: Open (current)
Total points: — /10
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:
element/orderBlocksCode
Title:
Element pl-order-blocks: code with ranking and indentation

Variant

Started at:
2026-08-04 16:38:09 (CDT)
Duration:
0s
Show/Hide answer
{
  "python-ordered": [
    {
      "tag": "c4324242-ae3f-4bd7-932c-f5d3e5be3c6a",
      "uuid": "d3f9b07c-2e09-4f63-8f5d-961ac9e90b5e",
      "final": false,
      "index": 0,
      "indent": 0,
      "depends": [],
      "ranking": 1,
      "group_info": {
        "tag": null,
        "depends": null
      },
      "inner_html": "<pl-code language=\"python\">def my_sum(first, second):</pl-code>",
      "distractor_for": null,
      "initially_placed": false,
      "ordering_feedback": null,
      "distractor_feedback": null
    },
    {
      "tag": "f6edef18-c08c-41de-83b5-bc4a35cdc3fd",
      "uuid": "d9973077-2746-4de8-91e0-4f8b820a3d63",
      "final": false,
      "index": 1,
      "indent": 1,
      "depends": [],
      "ranking": 2,
      "group_info": {
        "tag": null,
        "depends": null
      },
      "inner_html": "<pl-code language=\"python\">sum = 0</pl-code>",
      "distractor_for": null,
      "initially_placed": false,
      "ordering_feedback": null,
      "distractor_feedback": null
    },
    {
      "tag": "addfirst",
      "uuid": "c68ebafe-28be-45f9-b5c2-2f458dc9e71a",
      "final": false,
      "index": 2,
      "indent": 1,
      "depends": [],
      "ranking": 3,
      "group_info": {
        "tag": null,
        "depends": null
      },
      "inner_html": "<pl-code language=\"python\">sum += first</pl-code>",
      "distractor_bin": "cb479315-f1d2-4d5d-bae1-14994c656303",
      "distractor_for": null,
      "initially_placed": false,
      "ordering_feedback": null,
      "distractor_feedback": null
    },
    {
      "tag": "addsecond",
      "uuid": "ddabd099-2af1-4063-a9c8-f92fdc6a1063",
      "final": false,
      "index": 3,
      "indent": 1,
      "depends": [],
      "ranking": 3,
      "group_info": {
        "tag": null,
        "depends": null
      },
      "inner_html": "<pl-code language=\"python\">sum += second</pl-code>",
      "distractor_bin": "e7e9f849-78bd-413d-b6c2-683410ddc05e",
      "distractor_for": null,
      "initially_placed": false,
      "ordering_feedback": null,
      "distractor_feedback": null
    },
    {
      "tag": "dbb829e4-c5cc-496f-9fa8-83761a7bdd4f",
      "uuid": "e679cca4-47ca-4441-ad4a-7df761fa636e",
      "final": false,
      "index": 4,
      "indent": 1,
      "depends": [],
      "ranking": 4,
      "group_info": {
        "tag": null,
        "depends": null
      },
      "inner_html": "<pl-code language=\"python\">return sum</pl-code>",
      "distractor_for": null,
      "initially_placed": false,
      "ordering_feedback": null,
      "distractor_feedback": null
    }
  ]
}

Assessment instance

Assessment:
gallery/elements
Started at:
2026-08-04 16:37:17 (CDT)
Duration:
0s
View log
This box is not visible to students.