Jump to content

en English cardinal, python Z13588
en Implementation

د Wikifunctions لخوا
strip leading "and
NiferO (خبرې اترې | ونډې)
Translated content to igbo
 
(د همدغه کارن لخوا Template:پلورل)
۱۱ کرښه: ۱۱ کرښه:
"Z1K1": "Z16",
"Z1K1": "Z16",
"Z16K1": "Z610",
"Z16K1": "Z610",
"Z16K2": "def Z13587(Z13587K1):\n # define the units and tens place\n ones = [\"\", \"one \", \"two \", \"three \", \"four \", \"five \", \"six \", \"seven \", \"eight \", \"nine \", \"ten \", \"eleven \", \"twelve \", \"thirteen \", \"fourteen \", \"fifteen \", \"sixteen \", \"seventeen \", \"eighteen \", \"nineteen \"]\n tens = [\"\", \"\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\n units = [(\"trillion\", 1_000_000_000_000), (\"billion\", 1_000_000_000), (\"million\", 1_000_000), (\"thousand\", 1_000), (\"hundred\", 100), (\"\", 1)]\n\n # function to convert numbers less than 1000 to words\n def words(Z13587K1):\n if Z13587K1 == 0:\n return \"\"\n elif Z13587K1 \u003C= 19:\n return ones[Z13587K1]\n elif Z13587K1 \u003C= 99:\n tens_unit = tens[Z13587K1 // 10]\n ones_unit = ones[Z13587K1 % 10]\n return tens_unit + \"-\" + ones_unit if ones_unit else tens_unit\n else:\n return ones[Z13587K1 // 100] + \"hundred and \" + words(Z13587K1 % 100)\n\n # convert numbers to words\n if Z13587K1 == 0:\n return \"zero\"\n elif Z13587K1 \u003C 0:\n return \"negative \" + Z13587(-Z13587K1)\n else:\n result = \"\"\n for unit_name, factor in units:\n count, Z13587K1 = divmod(Z13587K1, factor)\n if count \u003E 0:\n if factor == 100:\n result = result + \" \" + ones[count] + unit_name\n elif factor == 1:\n result = result + \" and \" + words(count) + unit_name\n else:\n result = result + \" \" + words(count) + unit_name\n if (result.startswith(\" and \")): result = result[5:]\n return result.strip()"
"Z16K2": "def Z13587(Z13587K1):\n # define the units and tens place\n ones = [\"\", \"one \", \"two \", \"three \", \"four \", \"five \", \"six \", \"seven \", \"eight \", \"nine \", \"ten \", \"eleven \", \"twelve \", \"thirteen \", \"fourteen \", \"fifteen \", \"sixteen \", \"seventeen \", \"eighteen \", \"nineteen \"]\n tens = [\"\", \"\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\n units = [(\"quattuordecillion\", 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000),(\"tredecillion\", 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000),(\"duodecillion\", 1_000_000_000_000_000_000_000_000_000_000_000_000_000),(\"undecillion\", 1_000_000_000_000_000_000_000_000_000_000_000_000),(\"decillion\", 1_000_000_000_000_000_000_000_000_000_000_000),(\"nonillion\", 1_000_000_000_000_000_000_000_000_000_000),(\"octillion\", 1_000_000_000_000_000_000_000_000_000),(\"septillion\", 1_000_000_000_000_000_000_000_000),(\"sextillion\", 1_000_000_000_000_000_000_000),(\"quintillion\", 1_000_000_000_000_000_000), (\"quadrillion\", 1_000_000_000_000_000), (\"trillion\", 1_000_000_000_000), (\"billion\", 1_000_000_000), (\"million\", 1_000_000), (\"thousand\", 1_000), (\"hundred\", 100), (\"\", 1)]\n\n # function to convert numbers less than 1000 to words\n def words(Z13587K1):\n if Z13587K1 == 0:\n return \"\"\n elif Z13587K1 \u003C= 19:\n return ones[Z13587K1]\n elif Z13587K1 \u003C= 99:\n tens_unit = tens[Z13587K1 // 10]\n ones_unit = ones[Z13587K1 % 10]\n return tens_unit + \"-\" + ones_unit if ones_unit else tens_unit\n else:\n return ones[Z13587K1 // 100] + \"hundred and \" + words(Z13587K1 % 100)\n\n # convert numbers to words\n if Z13587K1 == 0:\n return \"zero\"\n elif Z13587K1 \u003C 0:\n return \"negative \" + Z13587(-Z13587K1)\n else:\n result = \"\"\n for unit_name, factor in units:\n count, Z13587K1 = divmod(Z13587K1, factor)\n if count \u003E 999:\n #ERROR: number is too large for this algorithm\n return \"ERROR: number is too large for this algorithm\"\n if count \u003E 0:\n if factor == 100:\n result = result + \" \" + ones[count] + unit_name\n elif factor == 1:\n result = result + \" and \" + words(count) + unit_name\n else:\n result = result + \" \" + words(count) + unit_name\n if (result.startswith(\" and \")): result = result[5:]\n return result.strip()"
}
}
},
},
۲۲ کرښه: ۲۲ کرښه:
"Z11K1": "Z1002",
"Z11K1": "Z1002",
"Z11K2": "English cardinal, python"
"Z11K2": "English cardinal, python"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1014",
"Z11K2": "Kadịnal Bekee, Python"
}
}
]
]
۳۴ کرښه: ۳۹ کرښه:
"Z1K1": "Z12",
"Z1K1": "Z12",
"Z12K1": [
"Z12K1": [
"Z11"
"Z11",
{
"Z1K1": "Z11",
"Z11K1": "Z1002",
"Z11K2": "uses American names for very large numbers."
},
{
"Z1K1": "Z11",
"Z11K1": "Z1014",
"Z11K2": "na-eji aha America maka ọnụọgụ buru ibu."
}
]
]
}
}

د ۰۰:۰۹, ۲۷ جون ۲۰۲۴ پورې تازه بڼه

This page displays in a limited way without JavaScript.