Computer scienceBackendFlaskTemplates

Jinja filters

Unique

Report a typo

function Description
unique(list) returns only the unique elements of a list (needs to be followed by list filter to get back list format)
list(value) converts a value into a list
length(sequence) returns the length of a sequence

Using the above, create a nested filter which returns the total number of unique elements in a list.

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

return render_template_string("""

<!---your code enters here----->
{{ ['item1','item2','item2','item100'] }}

""")
___

Create a free account to access the full topic