File size: 470 Bytes
4f6959c
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "task_id": "medium-2",
  "description": "Fix the factorial function with wrong base case",
  "buggy_code": "def factorial(n):\n    if n == 1:\n        return 0\n    return n * factorial(n - 1)\n",
  "correct_code": "def factorial(n):\n    if n == 1:\n        return 1\n    return n * factorial(n - 1)\n",
  "tests": [
    {"input": [1], "expected": 1},
    {"input": [3], "expected": 6},
    {"input": [5], "expected": 120},
    {"input": [4], "expected": 24}
  ]
}