tips
不知為何,例外用pass去瘋狂程設的批改交卷,會出現錯誤的數字。
code
count = 0
def say(num, space):
if num >= 10000000:
say(num/10000000, space)
num = int(num % 10000000)
print(" kuti", end="")
space = True
if num >= 100000:
if space == True:
print(" ", end="")
print(f"{int(num/100000)} lakh", end="")
space = True
num = int(num % 100000)
if num >= 1000:
if space == True:
print(" ", end="")
print(f"{int(num/1000)} hajar", end="")
space = True
num = int(num % 1000)
if num >= 100:
if space == True:
print(" ", end="")
print(f"{int(num/100)} shata", end="")
space = True
num = int(num % 100)
if num > 0:
if space == True:
print(" ", end="")
print(f"{int(num)}", end="")
space = True
num = 0
if num == 0 and space == False:
print("0", end="")
while 1:
try:
space = False
num = int(input())
count = count + 1
print(f"{count:4d}. ", end="")
say(num, space)
print()
except:
break
0 comments:
張貼留言