Z16432

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z16432"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z16431",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z610",
            "Z16K2": "def Z16431(Z16431K1):\n\tinput_value=Z16431K1\n\tones = [\"\", \"uno\", \"dos\", \"tres\", \"cuatro\", \"cinco\", \"seis\", \"siete\", \"ocho\", \"nueve\", \"diez\", \"once\", \"doce\", \"trece\", \"catorce\", \"quince\", \"dieciséis\", \"diecisiete\", \"dieciocho\", \"diecinueve\", \"veinte\", \"veintiuno\", \"veintidós\", \"veintitrés\", \"veinticuatro\", \"veinticinco\", \"veintiséis\", \"veintisiete\", \"veintiocho\", \"veintinueve\"]\n\ttens = [\"\", \"\", \"\", \"treinta\", \"cuarenta\", \"cincuenta\", \"sesenta\", \"setenta\", \"ochenta\", \"noventa\"]\n\thundreds = [\"\", \"ciento\", \"doscientos\", \"trescientos\", \"cuatrocientos\", \"quinientos\", \"seiscientos\", \"setecientos\", \"ochocientos\", \"novecientos\"]\n\tunits = [(\"nonillón\", 10 ** 54), (\"octillón\", 10 ** 48), (\"septillón\", 10 ** 42), (\"sextillón\", 10 ** 36), (\"quintillón\", 10 ** 30), (\"cuatrillón\", 10 ** 24), (\"trillón\", 10 ** 18), (\"billón\", 10 ** 12), (\"millón\", 10 ** 6), (\"\", 1)]\n\n\t# function to convert numbers less than 1_000_000 to words\n\tdef words(Z16431K1):\n\t\tif Z16431K1 \u003C 30:\n\t\t\treturn ones[Z16431K1]\n\t\telif Z16431K1 \u003C 100:\n\t\t\ttens_unit = tens[Z16431K1 // 10]\n\t\t\tones_unit = ones[Z16431K1 % 10]\n\t\t\treturn tens_unit + \" y \" + ones_unit if Z16431K1 % 10 else tens_unit\n\t\telif Z16431K1 \u003C 1_000:\n\t\t\thundreds_unit = hundreds[Z16431K1 // 100]\n\t\t\tif Z16431K1 == 100:\n\t\t\t\treturn \"cien\"\n\t\t\treturn hundreds_unit + \" \" + words(Z16431K1 % 100) if Z16431K1 % 100 else hundreds_unit\n\t\telse:\n\t\t\tif Z16431K1 // 1000 == 1:\n\t\t\t\treturn \"mil \" + words(Z16431K1 % 1_000)\n\t\t\telse:\n\t\t\t\tthousands = Z16431K1 // 1_000\n\t\t\t\tprefix = words(thousands)\n\t\t\t\t# drop -o in uno and veintiuno before mil\n\t\t\t\tif thousands % 10 == 1 and thousands % 100 != 11:\n\t\t\t\t\tprefix = prefix[:-1]\n\t\t\t\tif thousands % 100 == 21:\n\t\t\t\t\tprefix = prefix[:-2] + \"ún\"\n\t\t\t\treturn prefix + \" mil \" + words(Z16431K1 % 1000)\n\n\t# convert numbers to words\n\tif Z16431K1 == 0:\n\t\treturn \"cero\"\n\telif Z16431K1 \u003C 0:\n\t\treturn \"menos \" + Z13587(-Z16431K1)\n\n\tresult = \"\"\n\tfor unit_name, factor in units:\n\t\tcount, Z16431K1 = divmod(Z16431K1, factor)\n\t\t# units are 1_000_000 times each other\n\t\tif count \u003E 999_999:\n\t\t\t# ERROR: number is too large for this algorithm\n\t\t\tWikifunctions.Error(\"Z28307\",[str(input_value),\"999999999999999999999999999999999999999999999999999999999999\",\"es\"])\n\t\tprefix = words(count)\n\t\tif factor != 1:\n\t\t\t# plural for millón, billón, trillón, ... etc\n\t\t\tunit_name = (unit_name[:-2] + \"ones\") if count \u003E 1 else unit_name\n\t\t\t# drop -o in uno and veintiuno before units\n\t\t\tif count % 10 == 1 and count % 100 != 11:\n\t\t\t\tprefix = prefix[:-1]\n\t\t\tif count % 100 == 21:\n\t\t\t\tprefix = prefix[:-2] + \"ún\"\n\t\tif count \u003E 0:\n\t\t\tresult = result + \" \" + prefix + \" \" + unit_name\n\treturn result.strip()"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "Spanish cardinal, python"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1004",
                "Z11K2": "cardinal en espagnol, en Python"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1430",
                "Z11K2": "Spanische Kardinalzahl in Python"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "translates natural number to singular masculine cardinal number"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1430",
                "Z11K2": "Python-Implementierung der Funktion zur Ausgabe der Spanischen Kardinalzahl"
            }
        ]
    }
}