-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBadSorter.py
More file actions
34 lines (28 loc) · 800 Bytes
/
BadSorter.py
File metadata and controls
34 lines (28 loc) · 800 Bytes
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
list = []
for i in range(5):
Num = int(input("Enter a whole number"))
list.insert(i-1, Num)
def BubbleSort():
for i in range(len(list)):
if list[0] > list[1]:
Change = list[0]
Change1 = list[1]
list[0] = Change1
list[1] = Change
if list[1] > list[2]:
Change = list[1]
Change1 = list[2]
list[1] = Change1
list[2] = Change
if list[2] > list[3]:
Change = list[2]
Change1 = list[3]
list[2] = Change1
list[3] = Change
if list[3] > list[4]:
Change = list[3]
Change1 = list[4]
list[3] = Change1
list[4] = Change
print(list)
BubbleSort()