Z16173

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z16173"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z16172",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z610",
            "Z16K2": "def Z16172(Z16172K1):\r\n    \"\"\"\r\n    This function converts a number to its Moroccan Arabic representation.\r\n    It would definitely break for super large numbers which have no\r\n    corresponding representation. Add more elements to \"orders\"\r\n    if you want it to work for larger numbers (eventually you'll\r\n    get a stack overflow or timeout though).\r\n    NB: since Moroccan Darija is not standardized, some of the spellings\r\n    here reflect my preferences, and are not necessarily universal\r\n    \"\"\"\r\n\r\n    if Z16172K1 == 0:\r\n        return \"زيرو\"\r\n    if Z16172K1 \u003E 9999999999999999999999999999999999999999999999999999999999999999999:\r\n        Wikifunctions.Error(\"Z28307\",[str(Z16172K1),\"9999999999999999999999999999999999999999999999999999999999999999999\",\"ary\"])\r\n        \r\n    AND = \" و \"\r\n\r\n    units = [\"زيرو\", \"واحد\", \"جوج\", \"تلاتة\", \"ربعة\", \"خمسة\", \"ستة\", \"سبعة\", \"تمنية\", \"تسعود\"]\r\n    teens = [\"عشرة\", \"حضاش\", \"طناش\", \"تلطاش\", \"ربعطاش\", \"خمسطاش\", \"سطاش\", \"سبعطاش\", \"تمنطاش\", \"تسعطاش\"]\r\n    tens = [\"\", \"عشرة\", \"عشرين\", \"تلاتين\", \"ربعين\", \"خمسين\", \"ستين\", \"سبعين\", \"تمانين\", \"تسعين\"]\r\n\r\n    hundreds = [\"\", \"مية\", \"ميتين\", \"تلتمية\", \"ربعمية\", \"خمسمية\", \"ستمية\", \"سبعمية\", \"تمنمية\", \"تسعمية\"]\r\n    thousands = [\"\", \"ألف\", \"ألفين\", \"تلتالاف\", \"ربعالاف\", \"خمسالاف\", \"ستالاف\", \"سبعالاف\", \"تمنالاف\", \"تسعالاف\",\r\n                 \"عشرالاف\", \"حضاشرالف\", \"طناشرالف\", \"تلطاشرالف\", \"ربعطاشرالف\", \"خمسطاشرالف\", \"سطاشرالف\",\r\n                 \"سبعطاشرالف\", \"تمنطاشرالف\", \"تسعطاشرالف\"]\r\n\r\n    orders = [\"\", \"ألف\", \"مليون\", \"مليار\", \"تريليون\", \"كوادريليون\", \"كوينتيليون\", \"سيكستيليون\",\r\n              \"سيپتيليون\", \"ؤكتيليون\", \"نونيليون\", \"ديسيليون\", \"ؤنديسيليون\", \"دووديسيليون\",\r\n              \"تريديسيليون\", \"كواطوورديسيليون\", \"كوينديسيليون\", \"سيكسديسيليون\", \"سيپتينديسيليون\",\r\n              \"ؤكطوديسيليون\", \"نوڤيمديسيليون\", \"ڤيجينتيليون\"]\r\n\r\n    orders_plural = [\"\", \"ألاف\", \"ملاين\", \"ملاير\"]\r\n\r\n    def convert_number_to_19999(n):\r\n        if n == 0:\r\n            return \"\"\r\n        elif n \u003C 10:\r\n            return units[n]\r\n        elif n \u003C 20:\r\n            return teens[n - 10]\r\n        elif n \u003C 100:\r\n            if n % 10 == 0:\r\n                return tens[n // 10]\r\n            else:\r\n                if n % 10 == 2:\r\n                    return \"تنين و \" + tens[n // 10]\r\n                return units[n % 10] + AND + tens[n // 10]\r\n        elif n \u003C 1000:\r\n            if n % 100 == 0:\r\n                return hundreds[n // 100]\r\n            else:\r\n                return hundreds[n // 100] + AND + convert_number_to_19999(n % 100)\r\n        else:\r\n            if n % 1000 == 0:\r\n                return thousands[n // 1000]\r\n            else:\r\n                return thousands[n // 1000] + AND + convert_number_to_19999(n % 1000)\r\n\r\n    def convert_large_number(n):\r\n        if n \u003C 20000:\r\n            return convert_number_to_19999(n)\r\n\r\n        for order in range(len(orders) - 1, 0, -1):\r\n            order_value = 10 ** (order * 3)\r\n            if n \u003E= order_value:\r\n                major_part = n // order_value\r\n                remainder = n % order_value\r\n                major_part_str = convert_number_to_19999(major_part)\r\n                remainder_str = convert_large_number(remainder)\r\n                order_name = orders[order]\r\n\r\n                if major_part == 1:\r\n                    return (orders[order] + (AND + remainder_str if remainder else \"\")).strip()\r\n\r\n                if order_name == \"ألف\":\r\n                    return (major_part_str + \" \" + order_name + (AND + remainder_str if remainder else \"\")).strip()\r\n                else:\r\n                    if 2 \u003C= major_part % 100 \u003C 10:\r\n                        if order_name == \"مليون\" or order_name == \"مليار\":\r\n                            return (major_part_str + \" د ل\" + orders_plural[order] + (AND + remainder_str if remainder else \"\")).strip()\r\n\r\n                        return (major_part_str + \" د ل\" + orders[order] + \"ات\" + (AND + remainder_str if remainder else \"\")).strip()\r\n\r\n                    return (major_part_str + \" \" + order_name + (AND + remainder_str if remainder else \"\")).strip()\r\n\r\n    return convert_large_number(Z16172K1)"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "Moroccan Arabic cardinal, python"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1045",
                "Z11K2": "أعداد ب الداريجة، پايثون"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1004",
                "Z11K2": "cardinal en arabe marocain, en Python"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1430",
                "Z11K2": "Marokkanisch-Arabisches Zahlwort in Python"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "NB: given that Moroccan Darija lacks a common standard, many of the words for numbers may have various spellings, for example for the number 13 we can find تلطاش طلطاش تلتاش تلطاعش etc. The implementation reflects a personal choice."
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1004",
                "Z11K2": "étant donné que le darija marocain n'a pas de norme commune, de nombreux mots pour les nombres peuvent avoir des orthographes différentes, par exemple pour le chiffre 13, nous pouvons trouver تلطاش طل"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1430",
                "Z11K2": "Python-Implementierung der Funktion zur Ausgabe des Marokkanisch-Arabischen Zahlwortes"
            }
        ]
    }
}