Coding · Debug

Fix Code That Will Not Run

Get a corrected version of code that crashes or will not start, with every fix explained simply.

Prompt Code output

This code will not run and I am a beginner. Language: [LANGUAGE]. What it should do: [PURPOSE]. What happens when I run it: [WHAT_HAPPENS]. Here is the code: [CODE]. Please find what is stopping it, including small things like a missing bracket, wrong spacing or a misspelled name. Give me the full corrected code so I can replace mine in one go. Below it, list each change with the line it was on and a one-sentence reason in simple words. Do not rewrite parts that already work. Finally, tell me how to run it again and what I should see if it is fixed.

Fill in the brackets

[LANGUAGE]
e.g. Python, JavaScript, HTML, VBA
[PURPOSE]
e.g. read a list of names and print a greeting for each one
[WHAT_HAPPENS]
e.g. a red error appears straight away, or nothing happens at all
[CODE]
Paste the full code, with any passwords or keys removed

How to use

  1. Copy the prompt.
  2. Replace the text inside [BRACKETS] with your own details.
  3. Paste it into ChatGPT or another AI assistant.
  4. Read the result and ask for changes if needed.

Tip: Paste the whole file, not only the line you suspect; the real mistake is often a few lines earlier.