{"library":"ipdb","code":"import ipdb\n\ndef divide(a, b):\n    try:\n        # Set a breakpoint to inspect variables before the division\n        ipdb.set_trace()\n        result = a / b\n        return result\n    except ZeroDivisionError:\n        print(\"Cannot divide by zero!\")\n        return None\n\nprint(divide(10, 2))\n# To trigger the debugger on error, uncomment the line below and remove the try-except:\n# divide(10, 0)\n","lang":"python","description":"To use `ipdb.set_trace()`, simply place it where you want to pause execution. Run your script, and it will drop you into an interactive debugging session at that point. You can then inspect variables, step through code, and execute commands. Alternatively, run your script directly with `python -m ipdb your_script.py` to start debugging from the beginning or upon an exception.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}