Skip to main content
← CoursesFastAPI ProductionModule 0 · Before you startPrerequisites — what you should know before this trackpredict1 / 101
💬 Discuss🧪 Playground+25 XP
Task
Read the snippet below. Predict the **exact output** (two lines). This exercises the two patterns FastAPI is built on — decorators and type hints. If you can predict what `@uppercase` does to `greet`, you'll follow `@app.get("/")` in fastapi-01.

Keep going

🔮 Predict the output

Read the code carefully

def uppercase(fn):
    def wrapper(name: str) -> str:
        return fn(name).upper()
    return wrapper

@uppercase
def greet(name: str) -> str:
    return f"hi, {name}"

print(greet("anna"))
print(greet.__name__)

What will the program print? Write here:

📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…