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 Customizing Django Templates Building Custom Filters Reverse Text Filter

Jovan Dandridge
Jovan Dandridge
12,835 Points

this seems to easy yet im not getting it need help what am i missing? i also keep getting syntaxerror

what am i missing???

code_challenges/templatetags/extras.py
from django import template

register = template.Library()

def reverse_text("balloon"):
    return reversed()

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Your function must be more generic. The parameter in the function definition should take any string, not just the string "balloon". This was just given as an example. Treehouse is going to send in a string to that function and it should return to Treehouse the reversed string. However, we have no way of knowing what they're sending. Also the reversed() part is incorrect. Take a look:

from django import template

register = template.Library()

def reverse_text(myString):
    return myString[::-1]

Here we define a function named reverse_text that has one parameter for a string. We take that string and return the reversed version of it.

Hope this helps! :sparkles:

Jovan Dandridge
Jovan Dandridge
12,835 Points

Yes this helps me understand it a bit further, thank you!