0
0
Flaskframework~10 mins

Flash message categories in Flask - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to flash a message with the category 'success'.

Flask
flash('Operation completed successfully!', category='[1]')
Drag options to blanks, or click blank then click option'
Asuccess
Berror
Cwarning
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' or 'warning' instead of 'success' for positive messages.
Omitting the category parameter.
2fill in blank
medium

Complete the code to flash a warning message.

Flask
flash('Please check your input.', category='[1]')
Drag options to blanks, or click blank then click option'
Awarning
Binfo
Csuccess
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' when the message is not about a failure.
Using 'info' which is more neutral.
3fill in blank
hard

Fix the error in the flash message category to correctly show an informational message.

Flask
flash('New update available.', category='[1]')
Drag options to blanks, or click blank then click option'
Aerror
Bwarning
Csuccess
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the category string.
Using the wrong category for informational messages.
4fill in blank
hard

Fill both blanks to flash an error message with the correct category and message text.

Flask
flash('[1]', category='[2]')
Drag options to blanks, or click blank then click option'
AAn error occurred
Bsuccess
Cerror
DOperation completed
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing success messages with error categories.
Using 'success' category for error messages.
5fill in blank
hard

Fill all three blanks to flash a success message with dynamic content and the correct category.

Flask
flash(f'User [1] has been [2].', category='[3]')
Drag options to blanks, or click blank then click option'
Ausername
Bcreated
Csuccess
Ddeleted
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deleted' instead of 'created' for a success message.
Using 'error' or 'warning' as the category for a success message.