1. Python / Говнокод #18717

    −11

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    def checkio(number):
        str_num = ""
        lst = list(str(number))
        if len(lst) == 1:
            str_num = FIRST_TEN[int(lst[0])-1]
        if len(lst) == 2:
            if int(lst[0]) == 1:
                str_num = SECOND_TEN[int(lst[1])]
            elif int(lst[0]) > 1:
                if int(lst[1]) == 0:
                    str_num = OTHER_TENS[int(lst[0]) - 2]
                elif int(lst[1]) > 0:
                    str_num = OTHER_TENS[int(lst[0]) - 2] + ' ' + FIRST_TEN[int(lst[1])-1]
        if len(lst) == 3:
            if int(lst[1]) == 0:
                if int(lst[2]) == 0:
                    str_num = FIRST_TEN[int(lst[0])-1] + ' ' + HUNDRED
                elif int(lst[2]) > 0:
                    str_num = FIRST_TEN[int(lst[0])-1] + ' ' + HUNDRED + ' ' + FIRST_TEN[int(lst[2])-1]
            elif int(lst[1]) == 1:
                str_num = FIRST_TEN[int(lst[0])-1] + ' ' + HUNDRED + ' ' + SECOND_TEN[int(lst[2])]
            elif int(lst[1]) > 1:
                if int(lst[2]) == 0:
                    str_num = FIRST_TEN[int(lst[0])-1] + ' ' + HUNDRED + ' ' + OTHER_TENS[int(lst[1]) - 2]
                elif int(lst[2]) > 0:
                    str_num = FIRST_TEN[int(lst[0])-1] + ' ' + HUNDRED + ' ' + OTHER_TENS[int(lst[1]) - 2] + ' ' + FIRST_TEN[int(lst[2])-1]

    checkio просто кладезь

    Запостил: kyzi007, 13 Сентября 2015

    Комментарии (1) RSS

    Добавить комментарий