Challenge - 5 Problems
Flask Framework Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What is Flask used for?
Flask is a popular tool in Python. What is its main purpose?
Attempts:
2 left
💡 Hint
Think about what web developers need to create websites.
✗ Incorrect
Flask is a lightweight web framework in Python. It helps developers build web applications by providing tools to handle web requests and responses.
🧠 Conceptual
intermediate1:30remaining
Which feature is NOT part of Flask?
Flask provides many features. Which one is NOT included by default?
Attempts:
2 left
💡 Hint
Flask is minimal and lets you add extra tools as needed.
✗ Incorrect
Flask does not include a built-in ORM. Developers can add ORMs like SQLAlchemy separately.
❓ component_behavior
advanced2:00remaining
What happens when you run this Flask code?
Consider this Flask app code. What will the browser show when visiting '/'?
Flask
from flask import Flask app = Flask(__name__) @app.route('/') def home(): return 'Hello, Flask!' if __name__ == '__main__': app.run()
Attempts:
2 left
💡 Hint
Look at the route decorator and the returned string.
✗ Incorrect
The route '/' is linked to the home function, which returns 'Hello, Flask!'. Visiting '/' shows this text.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this Flask snippet
Which option correctly fixes the syntax error in this Flask code?
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home()
return 'Hi!'
app.run()
Attempts:
2 left
💡 Hint
Check the function definition line carefully.
✗ Incorrect
Python function definitions require a colon at the end of the def line. Missing colon causes SyntaxError.
❓ lifecycle
expert2:30remaining
What is the order of events when a Flask app handles a web request?
Put these steps in the correct order when Flask processes a web request:
1. Flask calls the view function
2. Browser sends HTTP request
3. Flask sends HTTP response back
4. Flask matches URL to route
Attempts:
2 left
💡 Hint
Think about what happens first: the browser sends a request or Flask matches routes?
✗ Incorrect
First, the browser sends the HTTP request. Then Flask matches the URL to a route, calls the view function, and finally sends the response.