Complete the code to define a URL pattern that connects the path 'home/' to the view function.
urlpatterns = [path('home/', [1])]
The URL pattern connects the URL 'home/' to the view function named home_view.
Complete the view function to render the 'home.html' template with the request.
def home_view(request): return [1](request, 'home.html')
The render function combines the request and template to create an HttpResponse.
Fix the error in the view function to correctly pass context data to the template.
def home_view(request): context = {'message': 'Hello!'} return render(request, 'home.html', [1])
The third argument to render is the context dictionary to pass data to the template.
Fill both blanks to complete the URL pattern that includes another app's URLs and names the route 'blog-home'.
urlpatterns = [path('blog/', [1]('blog.urls'), name=[2])]
include is used to include another URLconf, and the name is a string identifier for the route.
Fill all three blanks to create a dictionary comprehension that maps each word to its length if the length is greater than 3.
lengths = { [1]: [2] for [3] in words if len([3]) > 3 }This comprehension creates a dictionary where keys are words and values are their lengths, filtering words longer than 3 characters.