MRMCD12 deutsche zahlen by

x = {1:'eins',2:'zwei',3:'drei',4:'vier',5:'fuenf',6:'sechs',7:'sieben',8:'acht',9:'neun',10:'zehn',11:'elf',12:'zwoelf',13:'dreizehn',14:'vierzehn',15:'fuenfzehn',16:'sechzehn',17:'siebzehn',18:'achzehn',19:'neunzehn',20:'zwanzig',30:'dreissig',40:'vierzig',50:'fuenfzig',60:'sechzig',70:'sibzig',80:'achzig',90:'neunzig',100:'einhundert',1000:'eintausend'}
def y(n):
 if n in x: return x[n]
 if n < 100: return y(n%10)+"und"+y((n//10)*10)
 if n < 200: return y(100)+y(n%100)
 if n < 1000: return y(n//100)+"hundert"+y(n%100)
 if n < 2000: return y(1000)+y(n%1000)
 if n < 10000: return y(n//1000)+"tausend"+y(n%1000)
print y(input())


Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top