Intermediate
Debug Python Code
Identify and fix a logical error in a Python script.
📝 Nội dung Prompt
Analyze the provided Python code snippet that calculates the factorial of a number but returns incorrect results for negative inputs. Identify the bug and provide the corrected code.