File size: 548 Bytes
e298389 b56681c e298389 b56681c e298389 b56681c e298389 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from typing import Dict
import ast
MIN_TASK_SCORE = 0.01
MAX_TASK_SCORE = 0.99
def get_task() -> Dict:
return {
"id": "easy",
"difficulty": "easy",
"name": "lint_fix",
"objective": "Fix syntax errors so the candidate code parses successfully.",
"description": "Fix syntax errors in the given Python code.",
"grader_name": "grade",
"score_range": [MIN_TASK_SCORE, MAX_TASK_SCORE],
}
def grade(candidate_code: str) -> float:
try:
ast.parse(candidate_code)
return MAX_TASK_SCORE
except SyntaxError:
return MIN_TASK_SCORE
|