It’s right if you want it to behave differently from the original version (because your version produces different results).
Copy-paste this into the Template Editor and experiment with it:
{% set a = 230 %} {{ a }}
The original version:
{% if a < 80 -%} 0
{% elif a >= 80 and a < 170 -%} 100
{% elif a >= 170 and a < 220 -%} {{ (((-2*a+440)/10)|int)*10 }}
{% elif a >= 220 and a <= 250 -%} 0
{% elif a > 250 and a <= 300 -%} {{ (((2*a-500)/10)|int)*10 }}
{% else -%} 100
{% endif %}
Revised version:
{%- set values = { 80: 0,
170: 100,
220: (((-2*a+440)/10)|int(0))*10,
251: 0,
301: (((2*a-500)/10)|int(0))*10 } %}
{{ values.get(values.keys() | select('>', a) | first, 100) }}
Your version:
{%- set values = { 0: 0,
79: 100,
170: (((-2*a+440)/10)|int(0))*10,
220: 0,
250: (((2*a-500)/10)|int(0))*10,
301: 100 } %}
{{ values.get(values.keys() | select('>', a) | first, 100) }}