promptdojo_

Closures and the @ symbol — what AI is doing when it stacks decorators — step 8 of 9

Write a decorator called shout that takes a function returning a string, calls it, and returns the result UPPERCASED with ! added at the end. (A shout decorator makes things louder. That's what the name promises.)

Then decorate a function say_hi that returns "hi" and print the result.

Expected output:

HI!

full-screen editor opens — close anytime to keep reading.