Commit 6b20ae8c authored by Baber's avatar Baber
Browse files

add create_cloze_choices function

parent 1646596a
......@@ -36,19 +36,16 @@ def maybe_serialize(
)
def create_mc_choices(choices: list[str], choice_delimiter: str | None = "\n") -> str:
def create_mc_choices(choices: list[str], choice_delimiter: str = "\n") -> str:
"""Creates a multiple-choice question format from a list of choices."""
if len(choices) < 2:
raise ValueError(
"At least two choices are required for a multiple-choice question."
)
if choice_delimiter is None:
choice_delimiter = "\n"
formatted_choices = [f"{chr(65 + i)}. {choice}" for i, choice in enumerate(choices)]
return choice_delimiter.join(formatted_choices)
def create_cloze_choices(choices: list[str], choice_delimiter: str = "\n") -> str:
"""Creates a cloze-style question format from a list of choices."""
def doc_to_closure(fn: Callable[..., T]) -> Callable[..., T]:
"""Closure that allows the function to be called with 'self'."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment