Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Andy McDonald4,988 Points
Dont know HTML have no clue what im doing in flask.
First question. Is this homework trying to get me to make a list before I start running a for loop through it?
Second... am I doing the html portion right by simply opening and closing a list <li></li>?
Third... is this for loop correct? I've also tried print dict(option.items())['name'].
from flask import Flask, render_template from options import OPTIONS app = Flask(__name__) @app.route('/') def index(): return render_template('options.html', options=OPTIONS) for option in OPTIONS: print option.items()
<ul> <li> </li> </ul>
Megan AmendolaTreehouse Teacher
Hi! The code challenge is asking you to use a Flask templating for loop. It wants you to loop through the options being passed into the template inside of the index function. All you need to do is create the loop notation inside of the HTML file, so you don't need to add anything to the python file app.py.
The video before this code challenge shows an example of writing the for loop at the beginning. Here are some examples from the documentation too.
I also highly suggest checking out the prerequisites for this course if you haven't already. They include some HTML courses.