eval_python/data/code/shadok.py
2024-10-07 10:17:49 +02:00

15 lines
430 B
Python

SHADOK_CONVERSION = {"GA": 0, "BU": 1, "ZO": 2, "MEU": 3}
def translate_shadok_number_to_human_number(message: str) -> int:
"""
Translate a shadok number to human readable number.
example : BU MEU ZO MEU GA GA -> 1968
:param message:
:return:
"""
words = message.split()[::-1]
result = 0
for i, word in enumerate(words):
result += SHADOK_CONVERSION[word] * pow(4, i)
return result