I'm trying to display the average of numbers using jinja template but I couldn't make it up.
I'm getting the value of 'points' column from the Google app engine datastore entity 'Score'
Using python code and taking it in jinja template and I wanted to calculate the average of points and display through this template.
{% for num in number%}
        {{num.points}}
{% endfor %}
                {% set score = [] %}
{% for num in number %}
    {% if score.append(num) %}{% endif %}
{% endfor %}
Average score: 
{{ score | sum / score | count }}
http://jinja.pocoo.org/docs/dev/templates/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With