Complete the code to create a route for the home page using Flask.
from flask import Flask app = Flask(__name__) @app.[1]('/') def home(): return "Welcome to the home page!"
The @app.route decorator tells Flask which URL should trigger the home function.
Complete the code to create a route that responds to '/about' URL.
@app.[1]('/about') def about(): return "About us page"
The @app.route decorator is used to bind the URL '/about' to the about function.
Fix the error in the route decorator to make the '/contact' page work.
@app.route[1] def contact(): return "Contact page"
The route decorator requires parentheses around the URL string. The correct syntax is @app.route('/contact').
Fill both blanks to create a route for '/user/<username>' that returns a greeting.
@app.[1]('/user/<[2]>') def greet_user(username): return f"Hello, {username}!"
The @app.route decorator defines the URL pattern. The part inside <> is the variable name, here username.
Fill all three blanks to create a route for '/post/' that returns the post ID.
@app.[1]('/post/<[2]:[3]>') def show_post(post_id): return f"Post number {post_id}"
The @app.route decorator defines the route. The URL uses a converter int and variable name post_id matching the function parameter.