feat: will now return numerals from 0 to 19 correctly

This commit is contained in:
Sandro Zimmermann 2026-03-23 21:43:17 +01:00
parent 81b25abc2b
commit a5e72e9402

View File

@ -0,0 +1,39 @@
C = {
"-": "",
".": "",
0: "",
1: "",
2: "",
3: "",
4: "",
5: "",
6: "",
7: "",
8: "",
9: "",
10: "",
100: "",
1000: "",
10000: "",
11: "十一",
12: "十二",
13: "十三",
14: "十四",
15: "十五",
16: "十六",
17: "十七",
18: "十八",
19: "十九",
}
def to_chinese_numeral(n):
try:
return C[n]
except KeyError:
pass
return 10
print(to_chinese_numeral(20))