-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sort.py
109 lines (46 loc) · 843 Bytes
/
Sort.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python
# coding: utf-8
# In[8]:
cars = ['bmw','audi','toyota','subaru']
# In[4]:
cars.sort()
print(cars)
cars.sort(reverse=True)
print(cars)
# In[5]:
#临时排序
print("Here is the original list:")
print(cars)
print("\nHere is the sorted list:")
print(sorted(cars))
print("\nHere is the original list again:")
print(cars)
# In[9]:
cars.reverse()
print(cars)
# In[10]:
len(cars)
# In[26]:
place=["Japen","Gui Lin","ShangHai","Beijing","Maldives"]
print(place)
# In[27]:
print(sorted(place))
# In[28]:
print(sorted(place,reverse=True))
# In[29]:
print(place)
# In[30]:
place.reverse()
print(place)
# In[32]:
place.sort()
print(place)
# In[33]:
place.sort(reverse=True)
print(place)
# In[34]:
print(place[-1])
# In[35]:
while len(place)>=1:
place.pop()
# In[ ]: