Complete the program so that it displays the corresponding messages only when accessing the corresponding URL.
So, if the category is /info show messages in the info, /warning for warning, and so on.
Advanced responses
Filtering flashes
Report a typo
Sample Input 1:
GETSample Output 1:
correctWrite a program in Python 3
from flask import Flask, flash, get_flashed_messages
app = Flask('main')
@app.route('/info')
def info_view():
flash('There are some info', 'info')
flash('And some alert!', 'warning')
pass #your code here
@app.route('/warning')
def warn_view():
flash("Greatest hits of 50's!", 'info')
flash('O-oh, here is an alarm!', 'warning')
pass #your code here
@app.route('/error')
def error_view():
flash("We are the best company of the world!", 'about')
flash('We accidentally broke the authorization system...', 'error')
pass #your code here
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.