0
0
Flaskframework~10 mins

What is Flask - Interactive Quiz & Practice

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

Complete the code to import the Flask class from the flask package.

Flask
from flask import [1]
Drag options to blanks, or click blank then click option'
Arequest
Bflask
Capp
DFlask
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'flask' instead of 'Flask'.
Importing 'app' which is not a class.
Confusing 'request' with 'Flask'.
2fill in blank
medium

Complete the code to create a Flask app instance named 'app'.

Flask
app = [1](__name__)
Drag options to blanks, or click blank then click option'
AApp
BFlask
CApplication
DServer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Application' or 'App' which are not valid class names.
Using lowercase 'flask' which is incorrect here.
3fill in blank
hard

Fix the error in the route decorator to define a route for the home page.

Flask
@app.route([1])
def home():
    return "Hello, Flask!"
Drag options to blanks, or click blank then click option'
A'/'
B'home'
C"/"
D"home"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'home' instead of '/' as the route path.
Using double quotes instead of single quotes is okay but here single quotes are expected.
Missing quotes around the path.
4fill in blank
hard

Fill both blanks to run the Flask app only when this script is executed directly.

Flask
if __name__ == [1]:
    app.run([2])
Drag options to blanks, or click blank then click option'
A"__main__"
BTrue
CFalse
Ddebug=True
Attempts:
3 left
💡 Hint
Common Mistakes
Using True or False instead of the string '__main__' in the if condition.
Not passing debug=True to app.run() for development.
5fill in blank
hard

Fill all three blanks to create a route '/about' that returns 'About page'.

Flask
@app.route([1])
def [2]():
    return [3]
Drag options to blanks, or click blank then click option'
A'/about'
Babout
C"About page"
D'About page'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes for the return string is okay but here single quotes are expected.
Naming the function with capital letters or spaces.
Missing quotes around the route path.