-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
42 lines (36 loc) · 1.24 KB
/
app.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
"""
This is the main file that runs the program.
"""
from src.python.utils import validate
from src.python.utils import build_array
from src.python.utils import menu
from src.python.utils import sort_it
from src.python.utils import search_it
if __name__ == "__main__":
"""
Main function to run the program
and display the menu for the user to select the type of sort or search to perform
"""
arr = [5, 2, 4, 6, 1, 3] # The default array
soret_selected = False
search_selected = False
while True:
try:
menu.display_menu()
option = int(input("\n#Enter your choice (1-3):~$ "))
if option == 1:
arr = build_array.create_array()
elif option == 2:
arr = sort_it.sort_array(arr)
elif option == 3:
search_it.search_target(arr)
elif option == 4:
"""
Exits the application.
"""
print("\nExiting the application!\n")
break
else:
validate.invalid_option(num_options=3)
except ValueError:
print("\n=> Invalid input. Please enter a valid number.")