Computer scienceBackendFlaskTemplates

Jinja filters

Map out!

Report a typo

Map is a built-in filter that has similar functionality to the map() function in Python. It applies a filter to a sequence.
For example, to apply a filter called double which as the name suggests doubles the number of each member of a list, we can use map as follows:

{{ our_list|map('double') }}

join is another built-in filter that joins the member of the lists it is applied to.

{{ [1,0,0,1] | join(".") }} results in "1.0.0.1"
Use both filters: map, lower, and join to lowercase each element of the following list and join them into a single string separated by a comma

lang_list = ["PYTHON","JAVA","HASKELL"]

The result should be

'python, java, haskell'

Put your answer inside the template of render_template

Write a program in Python 3
@app.route("/")
def home():

return render_template("""
<p>
<!--put your answer here---->
{{ lang_list }}
</p>
""", lang_list = lang_list)
___

Create a free account to access the full topic