BestPromptFinder
HomeDebugging › Below is an instruction that describes a task. Write a respo...

Below is an instruction that describes a task. Write a respo...

Debugging · General · Coding
55Quality
88%Useful
85Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Analyze the following Python function to detect any potential errors. ### Input: def expand_list(list): for item in list: list *= 2 ### Output: The function is attempting to modify the list while iterating over it. This can lead to unexpected behavior and should be avoided. To fix the code, the list should be copied before the iteration takes place: def expand_list(list): list_copy = list[:] # make a copy of the list for item in list_copy: list *= 2
Find similar in the app →

Why this prompt

Source

Hugging Face

Related Debugging prompts

Bug Reproduction Detective
Quality 93 · Claude Code
Security-Focused Code Review
Quality 93 · Claude Code
Performance Bottleneck Optimizer
Quality 93 · Claude Code
Production Incident Root Cause
Quality 93 · Claude Code
Python Bug Triage Assistant
Quality 92 · Gemini, GPT-5.6, Claude
Code Review Assistant
Quality 90 · GPT-5.6