Lesson 3 — Views as functions
A view turns a request into a response
When someone opens a page, Django calls a view: a function that receives the request (what the browser asked for) and returns a response (what to send back, usually HTML). In real Django it looks like def home(request): return HttpResponse("Hi").
Here we simulate it: the request is a small dict and the response is a string.
def home_view(request):
return "Hello " + request["user"]
Note: the exercise runs in your browser without Django installed, so it is a small plain-Python simulation of what Django does for you.
Why it matters: every page on a Django site is produced by a view — this is the main thing you will write.
Finish home_view so it returns "Hello <user>, welcome to the site" using the user from the request.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.