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

what am i doing wrong with this code challenge?

ive figured out two different ways to accomplish the goal (one with a for loop, and one without, included both in my code) and neither one work. it could be my jinja2 syntax is off, but i cant see where its wrong. any help?

lunch.py
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    class User:
        email = None
    user = User()
    user.email = 'kenneth@teamtreehouse.com'
    return render_template('user.html', user=user)
templates/macro.html
{% macro hide_email(User) %}
{% split_email = User.email.split("@") %}
{% star_list = [x for x in split_email[0][1:]] %}
{{ split_email[0][0]+"*"*len(star_list)+"@"+split_email[1]) }}
{% endmacro %}


email = "aaa@bbb.com"
split_email = email.split("@")
print(split_email[0][0]+"*"*len(split_email[0][1:])+"@"+split_email[1])