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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Flask Basics Character Builder Looping Through Items

templates/options.html

I have been pulling my hair out for twenty minutes trying to solve this. I can't look at the options file to see what data I should be accessing, and the question is so vague I can't figure out what I am missing. According to this question I should be able to imbed a for loop as "for item in options" and then do <li>item to complete this challenge. But if I do that I get a parse error on line 19 which neither page of this challenge has 19 lines of code, and if I change the "options" in the for loop to "options[]" then it says its not printing enough lines of <li>, 0 lines found.

app.py
from flask import Flask, render_template

from options import OPTIONS

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('options.html', options=OPTIONS)
templates/options.html
<ul>
  {% for name in options %}
    <li>{{ name }}
  {% endfor %}
</ul>

Thanks yeah I finally figured that out, but I was also missing something else too so it kept failing on me.

1 Answer

Hello, Here is a hint. Whenever you open something you have to close it, for example You opened <ul> and you closed it</ul>. Hope this helps.