hard
Python Debugging Assistant
Identify and fix a specific logic error in a Python function.
📝 Contenido del prompt
Analyze the following Python code snippet that is intended to calculate the factorial of a number but is returning incorrect results for negative inputs. Identify the bug, explain why it happens, and provide the corrected code.