Intermediate
Debug Python Code
Identify and fix a logical error in a Python script.
📝 प्रॉम्ट सामग्री
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.