Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Andy McDonaldPython Development Techdegree Graduate 13,801 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.