Skip to content

Binary search workshop has wording, code-formatting, and solution-indentation errors #71166

Closed

Description

@majestic-owl448

Describe the Issue

The binary search workshop has wording, code-formatting, and solution-indentation problems:

  1. Step 1 (683ec39565dbc7e3375263b1) uses a singular article before two parameters in both the description and hint:

    To begin, create a `binary_search` function with a `search_list` and `value` parameters.

    Your `binary_search` function should have a `search_list` and `value` parameters.

    The article a does not agree with the plural parameters.

  2. Step 4 (683ec95f2f8781355556ff7c) leaves one occurrence of high without code formatting:

    Inside the `binary_search` function, create a `while` loop with a condition that checks if `low` is less than or equal to high. Inside the loop, add the `pass` keyword as a placeholder for now.

    This is inconsistent with the formatting of low and the other occurrences of high in the same description.

  3. Step 12 (683ec95f2f8781355556ff84) misdescribes how updating the lower search boundary affects the search:

    This will extend the search to the right half of the current search areas in the list, because if the `value` is greater than `value_at_middle`, it means the `value` must be in the right half of the current search area.

    Updating low narrows the search range. It does not extend it. The comparison also does not establish that the target exists in the list.

  4. Step 16 (68416d66013635cb6325eb6d) uses inconsistent indentation in the final solution:

            if value == value_at_middle:
              return path_to_target, f"Value found at index {mid}"

    The return statement is indented only two spaces beyond its if statement, while the surrounding Python code uses four spaces per indentation level.

Affected Pages

https://www.freecodecamp.org/learn/python-v9/workshop-binary-search/step-1

https://www.freecodecamp.org/learn/python-v9/workshop-binary-search/step-4

https://www.freecodecamp.org/learn/python-v9/workshop-binary-search/step-12

https://www.freecodecamp.org/learn/python-v9/workshop-binary-search/step-16

Expected behavior

The description and hint in Step 1 should describe the two parameters with correct grammar. Variable names in Step 4 should use consistent code formatting.

Step 12 should explain that the search narrows to the right half and that the target must be in that half only if it is present in the list.

The final solution in Step 16 should use consistent four-space indentation increments.

Activity

  1. added
    help wanted
    scope: curriculum
    python v9 cert
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedpython v9 certscope: curriculum

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions