Library › Coding AI › High school students

Get 3 clues about a buggy average without the answer

Practice: Setting limits and rules. About 5 minutes.

About this exercise

Your intro Java program printed 'Average: 60' when you expected about 78.75, and you want to fix it yourself. Ask for exactly 3 numbered lines, each under 25 words: one per bug you'll need to hunt for, plus a last line telling you which line of code to test first. No code blocks and no corrected code anywhere, with under 100 words in total.

Common mistakes when you ask AI for this

  • Getting the fixed program. The AI's default is to hand you corrected code, which skips the part where you learn to debug. Try: Say: "Don't give me corrected code, just point me at the bugs."
  • A long lecture. The AI explains loops, arrays and data types from scratch. Try: Add: "Exactly 3 numbered lines, each under 25 words."
  • Only one bug found. The AI may stop after the first bug, but there are two reasons the number is low. Try: Add: "There may be more than one bug; one line per bug."

What a strong prompt includes

  • Asks for clues, not the fix
  • Sets the number of lines
  • Caps each line
  • Says there may be more than one bug
  • Gives the expected result

Practice this now ↑

Related exercises