0
0
Flaskframework~10 mins

Why Flask as a micro-framework - Test Your Understanding

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

Complete the code to import Flask correctly.

Flask
from flask import [1]
Drag options to blanks, or click blank then click option'
Arequest
Bapp
CFlask
Dflask
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'flask' instead of 'Flask'.
Importing 'app' instead of 'Flask'.
2fill in blank
medium

Complete the code to create a Flask app instance.

Flask
app = [1](__name__)
Drag options to blanks, or click blank then click option'
AFlask
Bflask
CApp
Dapplication
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'flask' instead of 'Flask'.
Using undefined names like 'App' or 'application'.
3fill in blank
hard

Fix the error in the route decorator syntax.

Flask
@app.route([1])
def home():
    return "Hello, Flask!"
Drag options to blanks, or click blank then click option'
Ahome
B/
C"home"
D'/'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the route path.
Using variable names instead of string paths.
4fill in blank
hard

Fill both blanks to run the Flask app in debug mode on port 5000.

Flask
if __name__ == '__main__':
    app.run(debug=[1], port=[2])
Drag options to blanks, or click blank then click option'
ATrue
BFalse
C5000
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Setting debug to False during development.
Using wrong port numbers.
5fill in blank
hard

Fill all three blanks to create a simple route that returns 'Welcome!' when visiting '/welcome'.

Flask
@app.route([1])
def [2]():
    return [3]
Drag options to blanks, or click blank then click option'
A'/welcome'
Bwelcome
C"Welcome!"
D'/'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong route path or missing quotes.
Naming function with invalid names.
Returning without quotes or wrong string.