diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 6d6fb1ed200..99eb0a9c034 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -616,8 +616,9 @@ def base64_decode(value): def ordinal(value): """Perform ordinal conversion.""" return str(value) + (list(['th', 'st', 'nd', 'rd'] + ['th'] * 6) - [(int(str(value)[-1])) % 10] if not - int(str(value)[-2:]) % 100 in range(11, 14) else 'th') + [(int(str(value)[-1])) % 10] if + int(str(value)[-2:]) % 100 not in range(11, 14) + else 'th') @contextfilter