Senior Programmer Reviews Beginner Code

Reviews beginner code for logic errors, readability and efficiency, writes a corrected version and explains why each change helps.

  • 🤖 Gemini
  • 🗂️ Coding

Last verified: write-up checked

Prompt by Shipra, Google (google-gemini/cookbook) · Original source (opens in a new tab)

Senior Programmer Reviews Beginner Code — prompt preview

The prompt

prompt
As a senior programmer, you are tasked with reviewing beginner-level code.
Please follow these instructions for the evaluation:

1. Provide detailed feedback on the code, focusing on:
   - Logic errors
   - Code readability and naming conventions
   - Code efficiency and best practices

2. Write a corrected version of the code, addressing the identified issues.

3. Clearly point out the changes you made and explain why they improve the original code.

What it is

Reviews beginner code for logic errors, readability and efficiency, writes a corrected version and explains why each change helps. The source first generates deliberately flawed code, then reviews it. The prompt text comes from the Google Gemini API cookbook (Apache-2.0, Copyright 2026 Google LLC). Only the code indentation around it was removed. Original author: Shipra, Google (google-gemini/cookbook).

Who it's for

  • Beginner programmers
  • Mentors

يراجع كود المبتدئين من حيث أخطاء المنطق والوضوح والكفاءة، ويكتب نسخة مصححة ويشرح فائدة كل تغيير.

Examples

Buggy code given to the reviewer (excerpt)

python
python
def do_Process(lst_a):
    LIST_2 = []
    for x in lst_a:
     found = False
     for y in LIST_2:
      if x == y:
       found = True
     if found == False:

What it does: From the code generated in the source with deliberate mistakes.

Review output (excerpt)

Prompt
prompt
Hello! As a senior programmer, I have reviewed your code. While your logic correctly identifies the unique elements, filters them, and sorts them, the implementation is inefficient and doesn't follow Python's best practices (PEP 8).

Below is my evaluation and a refactored version of your code.

### 1. Code Evaluation

#### **Logic Errors & Inefficiencies**

Expected output: The start of the review printed in the source.

Tips

  • The source passes this as a system instruction and the code as the content.