题解 | #数字颠倒#
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#使用栈来实现倒序输出 class TestStack: def __init__(self): self.stack=[] def push(self,data): self.stack.append(data) def pop(self): data=self.stack[-1] del self.stack[-1] return data stack = TestStack() n = input() for i in n: stack.push(i) for i in range(len(n)): print(stack.pop(),end = '')