pythonbook/Python 基础教程/1.5.7 B 练习2.py

12 lines
188 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2.给一个不多于5位的正整数要求一、求它是几位数二、逆序打印出各位数字。
x = int(input())
y = list(str(x))
print(len(y))
y.reverse()
print(y)