ComenzarEmpieza gratis

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)

Este ejercicio forma parte del curso

AI-Assisted Coding for Developers

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Pon en práctica la teoría con uno de nuestros ejercicios interactivos

Empezar ejercicio