ComeçarComece de graça

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 exercício faz parte do curso

AI-Assisted Coding for Developers

Ver curso

Instruções do exercício

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

Exercício interativo prático

Transforme a teoria em ação com um de nossos exercícios interativos

Começar o exercício