- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselection.py
More file actions
Latest commit
19 lines (16 loc) · 442 Bytes
/
Copy pathselection.py
File metadata and controls
19 lines (16 loc) · 442 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fromrandomimportrandint
a= [randint(1,1000) foriinrange(20)]
#create new list
b= []
print("-"*5)
print("First status of the list: ", a)
whilelen(a) >0:
#find the minimum number
minimum=0
foriinrange(1,len(a)):
ifa[i] <a[minimum]:
minimum=i
#remove from the list, add it to a new list from low to high
b.append(a.pop(minimum))
print("Last status of the list: ", b)
print("-"*5)