Debug Intermittent Calculator Bug
From Wikiprompt, the free prompt encyclopedia
Debug Intermittent Calculator Bug A structured prompt template for debugging a specific code issue, providing context, problem, goal, and codebase sections for the AI to analyze.
Prompt ContentSave
π
<context>
I'm building a simple Python calculator application. It's a command-line interface (CLI) application for now, focusing on basic arithmetic operations. I'm using standard Python libraries and haven't implemented any complex error handling or UI yet.
<problem>
When I perform a simple addition, like '2 + 2', the calculator sometimes returns '5' instead of '4'. This doesn't happen consistently, but it's reproducible after a few calculations. It seems to be more frequent after performing a division operation.
</problem>
<goal>
Identify the cause of this incorrect addition result and ensure that basic arithmetic operations, specifically addition, always return the correct value. I need to find the bug in my logic that's causing this intermittent incorrect calculation, possibly after a division.
</goal>
</context>
<codebase>
<file1>
{{Your file 1 content}}
</file1>
<file2>
{{Your file 2 content}}
</file2>
</codebase>
Sign in to see the full prompt
Continue with:
By logging in, you agree to our Terms of Use and Privacy Policy
Usage
This prompt is designed for use with coding. Copy the prompt content above and paste it into your preferred AI tool.
For best results, you may customize the placeholders (indicated by square brackets or capital letters) with your specific requirements.
References
- Category: coding Prompts
- Source: https://x.com/itsPaulAi/status/1870892046829179324
Talk
0 comments