题目:
给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。
def number(n):
# 求几位数
judge = True;
i = 0
while judge:
if n//(10**i)==0:
judge = False
weishu = i
i += 1
str_num = str(n);
# 逆序打印
for j in range(weishu-1,-1,-1):
print(str_num[j])
return weishu
c = number(7854)