#!/usr/bin/env python3
a = ['one', 'two', 'three','four','five','six','seven','eight','nine','ten']
def reverse(a):
if len(a)<=1:
print (a[0],end=" ")
else:
print(a[-1],end=" ")
reverse(a[0:-1])
reverse(a)
#3
参考方法:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
numlist = [100,1,23,4,5,6,6,7,7,8]
for i in range(0,len(numlist)) :
index = len(numlist)-i-1
print(numlist[index])
#2
参考:
a = ['1','2','3']
a.sort(reverse=True)
for i in a:
print(i)
#1
Python2.x 与 Python3.x均可用:
numbers=list(range(1,10))
reversed_list=[]
for i in range(1,10):
reversed_list.append(numbers.pop())
print(reversed_list)
其他参考解法:
使用列表 reverse():
Python3实例,使用递归实现:
参考方法:
参考:
Python2.x 与 Python3.x均可用: