Spaces:
Sleeping
Sleeping
File size: 595 Bytes
5a7a1be | 1 2 3 4 5 6 7 8 9 10 11 12 13 | {
"task_id": "medium-1",
"description": "Fix the function that should return max but returns min",
"buggy_code": "def find_max(nums):\n result = nums[0]\n for n in nums:\n if n < result:\n result = n\n return result\n",
"correct_code": "def find_max(nums):\n result = nums[0]\n for n in nums:\n if n > result:\n result = n\n return result\n",
"tests": [
{"input": [[1, 5, 3]], "expected": 5},
{"input": [[10, 2, 8]], "expected": 10},
{"input": [[-1, -5, -2]], "expected": -1},
{"input": [[7]], "expected": 7}
]
}
|