题解 | 字符串反转
def rev_digits(n): n_str = str(n) nr_str = [] m = len(n_str) for i in range(m): nr_str.append(n_str[m-i-1]) return ''.join(nr_str) n = input().strip() print(rev_digits(n))
def rev_digits(n): n_str = str(n) nr_str = [] m = len(n_str) for i in range(m): nr_str.append(n_str[m-i-1]) return ''.join(nr_str) n = input().strip() print(rev_digits(n))
相关推荐