Quiz: Jinja

Test your knowledge of Jinja.

1

Which template compiles as follows?

Bob is awake! Play with him.
A)
{{ set bob_asleep=False }}
{{ if bob_asleep }}
Shhh, don't make noise! Bob is asleep.
{{ else }}
Bob is awake! Play with him.
{{ endif }}
B)
{%- set bob_asleep=False %}
{%- if bob_asleep %}
Shhh, don't make noise! Bob is asleep.
{% else -%}
Bob is awake! Play with him.
C)
{%- set bob_asleep=False %}
{%- if bob_asleep %}
Shhh, don't make noise! Bob is asleep.
{% else -%}
Bob is awake! Play with him.
{% endif %}
D)
{%- set bob_asleep=True %}
{%- if bob_asleep %}
Shhh, don't make noise! Bob is asleep.
{% else -%}
Bob is awake! Play with him.
{% endif %}
Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.