标签:
完成如下功能:
1. 递归从后向前。
123456->654321
def f(s): if len(s) == 1: print s else: print s[len(s) - 1], f(s[:len(s) - 1])
2. 递归取两边
123456->162534
def f(s, beg = 0): end = len(s) - 1 - beg if beg <= end: print s[beg], s[end], beg += 1 f(s, beg)
标签:
原文地址:http://www.cnblogs.com/iNeoWong/p/4832228.html