Get startedGet started for free

Prompts for effective debugging

You work at a banking company where you're building a pipeline that processes and stores user-submitted data. One preprocessing step converts strings to uppercase before saving them to a central database, but you've noticed a bug.

At this step, an input ['a', 'b', 'c'] should produce ['A', 'B', 'C'], but the current script returns ['C', 'C', 'C'] instead.

The process_data.py file, that the LLM can read and use, contains the faulty function:

def to_uppercase(strings):
  uppercased = [s.upper() for s in strings]
  return [uppercased[-1]] * len(strings)

This exercise is part of the course

AI-Assisted Coding for Developers

View Course

Exercise instructions

- Prompt the model to debug the function by including the **faulty code**, the **expected behavior**, and asking for clear **reasoning steps**.

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise