Python 32
[Python 100] Python 100
#!/usr/bin/python
# -*- coding: UTF-8 -*-
a = ['one', 'two', 'three']
for i in a[::-1]:
print (i)
three two one
[Python 100] Python 100
| [ Web Proxy ] |
| Viewing: https://www.runoob.com/python/python-exercise-example32.html | [Back] [Original] |
[Python 100] Python 100
three two one
[Python 100] Python 100
| Web Proxy Viewer | New URL | Original Page |
a12***[email protected]
a12***[email protected]
114***[email protected]
reverse():
114***[email protected]
Think_dfrent
iwa***[email protected]
Python3:
#!/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)Think_dfrent
iwa***[email protected]
lan***[email protected]
#!/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])lan***[email protected]
107***[email protected]
a = ['1','2','3'] a.sort(reverse=True) for i in a: print(i)107***[email protected]
239***[email protected]
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)239***[email protected]