-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (24 loc) · 850 Bytes
/
main.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
from customBubbleSort import customBubbleSort
sampleData = [{"minTemp": 4, "maxTemp": 10}, {"minTemp": -4, "maxTemp": 18}, {"minTemp": 4, "maxTemp": 10}, {"minTemp": 2, "maxTemp": 12}]
while True:
sortKey = input("\nSelect key to sort list of dictionaries by:\n1) Minimum temperature\n2) Maximum temperature\n")
if sortKey == "1":
sortKey = "minTemp"
break
elif sortKey == "2":
sortKey = "maxTemp"
break
else:
print("Invalid option. Choose 1 or 2.")
while True:
direction = input("In what order?\n1) Ascending\n2) Descending\n")
if direction == "1":
direction = True
break
elif direction == "2":
direction = False
break
else:
print("Invalid option. Choose 1 or 2.")
customBubbleSort(sampleData, sortKey, direction)
print(sampleData)