Complete the code to import the function needed to clear the user session in Flask.
from flask import [1]
In Flask, session is used to manage user session data, including clearing it on logout.
Complete the code to remove all data from the user session during logout.
def logout(): [1].clear() return redirect('/')
The session.clear() method removes all data stored in the user's session.
Fix the error in the logout route decorator to correctly define the logout URL.
@app.route('[1]') def logout(): session.clear() return redirect('/')
The logout function should be mapped to the /logout URL path.
Fill both blanks to import redirect and define the logout route correctly.
from flask import [1], session @app.route('[2]') def logout(): session.clear() return redirect('/')
You need to import redirect to send users to another page, and the route should be /logout.
Fill all three blanks to complete a logout function that clears the session, flashes a message, and redirects to login.
from flask import [1], session, redirect, url_for from flask import flash @app.route('/logout') def logout(): session.[2]() flash('You have been logged out successfully.', '[3]') return redirect(url_for('login'))
Import flash to show messages, use session.clear() to remove session data, and use info as the category for the flash message.