추가 '내림차순'
This commit is contained in:
parent
f77b33fd1f
commit
81df6d9411
|
|
@ -0,0 +1,29 @@
|
|||
import random
|
||||
r=random.randint(1, 10)
|
||||
a=0
|
||||
b=0
|
||||
c=0
|
||||
t=0
|
||||
u=0
|
||||
list=[]
|
||||
|
||||
while t<4:
|
||||
r=random.randint(1, 10)
|
||||
list.append(r)
|
||||
t+=1
|
||||
|
||||
print(list)
|
||||
|
||||
t=0
|
||||
while t<len(list):
|
||||
u=t+1
|
||||
while u < len(list):
|
||||
if list[t]>list[u]:
|
||||
c = list[t]
|
||||
list[t] = list[u]
|
||||
list[u] = c
|
||||
u+=1
|
||||
t+=1
|
||||
|
||||
|
||||
print(list)
|
||||
Loading…
Reference in New Issue