Python编程PTA题解大全——索引
Description:程序每次读入一个正3位数,然后输出按位逆序的数字。注意:当输入的数字含有结尾的0时,输出不应带有前导的0。比如输入700,输出应该是7。
Input:输入仅一行,输入一个3位的正整数。
Output:输出仅一行,输出按位逆序的数。
Sample Input:123
Sample Output:321
n = int(input())
s = ''
while n != 0:
s += str(int(n % 10))
n = int(n / 10)
print(int(s))