Python 40
[Python 100] Python 100
#!/usr/bin/python
# -*- coding: UTF-8 -*-
if __name__ == '__main__':
a = [9,6,5,4,1]
N = len(a)
print (a)
for i in range(len(a) // 2):
a[i],a[N - i - 1] = a[N - i - 1],a[i]
print (a)
[9, 6, 5, 4, 1] [1, 4, 5, 6, 9]
[Python 100] Python 100
nathan
bin***[email protected]
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = [9,6,5,4,1] print a[::-1]nathan
bin***[email protected]
126***[email protected]
reverse()
126***[email protected]
253***[email protected]
# coding:utf-8 List1=[2,5,4,8,3,1,9] print(":",List1) print() List2=List1[-1::-1] print(":",List2)253***[email protected]
iml***[email protected]
#!/usr/bin/python # -*- coding: UTF-8 -*- a = ['1','2','3','4','5','6'] c = 0 d = [] for i in a: c+= 1 d.append(a[-c]) print diml***[email protected]
Webben
wei***[email protected]
#!/usr/bin/python3 # -*- coding: UTF-8 -*- i = [1,2,3,4,5,6]; n = len(i); d = []; while( n > 0 ): d.append(i[n-1]); n -= 1; print(d);Webben
wei***[email protected]
Tongfei
315***[email protected]
Tongfei
315***[email protected]
374***[email protected]
Python3
a=[0,1,2,3,4,5,6,7,8,9] for i in range(0,10): print(a.pop(),end='')374***[email protected]