aboutsummaryrefslogtreecommitdiff
path: root/challenge-173/lubos-kolouch/python/ch-1.py
blob: d644b5fe302057a4ab62582884b09f6840a3d750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
""" Challenge 173 Task 1 LK """


def is_esthetic_number(what: int) -> bool:
    """Check if the number is esthetic"""

    for pos, num in enumerate(str(what)[0:-1]):
        if abs(int(num) - int(str(what)[pos + 1])) != 1:
            return False

    return True


assert is_esthetic_number(5456) == 1
assert is_esthetic_number(120) == 0