Debugging with the help of chat bot

Rubber Duck Debugging

Instead of just asking ChatGPT to debug your code, do this:

Step 1: Use This Prompt

You are my AI rubber duck. I will explain my code to you step by step. Whenever you detect a logical flaw, inefficiency, or potential bug, stop me and ask a leading question instead of giving the answer immediately.

Step 2: Explain Your Code

If thinks there is an error you cab ask questions

Example

1 What happens if this variable is None?

2 Are you sure this loop terminates efficiently?

3 What if this function receives unexpected input?