-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (46 loc) · 1.94 KB
/
main.py
File metadata and controls
56 lines (46 loc) · 1.94 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from consoles.console import Console
from algorithm.user_numbers import UserNumbersAlgorithm
from algorithm.predefined_algorithm import PredefinedAlgorithm
from algorithm.random_numbers_algorithm import RandomNumbersAlgorithm
def first_startup_menu_dialog():
print("Welcome to Triangle Finder\n\n")
print("Enter a number to continue:")
print("1. Enter your numbers as sides of the triangle")
print("2. Run program with predefined values (7, 10, 5, 4, 8, 7)")
print("3. Run program with random numbers\n\n")
def read_number_list() -> list:
number_list = []
number_inserted = True
while number_inserted:
number = input("Type a number or 0 to stop: ")
if int(number) == 0:
number_inserted = False
else:
number_list.append(int(number))
else:
return number_list
console_functions = Console()
first_startup_menu_dialog()
user_choice = input("Your choice: ")
console_functions.clear_console()
if int(user_choice) == 1:
# User Defined Numbers
all_user_numbers = read_number_list()
algorithm_functions = UserNumbersAlgorithm(all_user_numbers)
algorithm_functions.find_all_possible_triangles()
algorithm_functions.print_data()
elif int(user_choice) == 2:
# Predefined Numbers
predefined_numbers = [7, 10, 5, 4, 8, 7]
algorithm_functions = PredefinedAlgorithm(predefined_numbers)
algorithm_functions.find_all_possible_triangles()
algorithm_functions.print_data()
elif int(user_choice) == 3:
# Array with Random Numbers
list_length = input("Give the length of the array: ")
start_number = input("Give the start number of the random function: ")
end_number = input("Give the end number of the random function: ")
algorithm_functions = RandomNumbersAlgorithm(int(list_length), int(start_number), int(end_number))
algorithm_functions.find_all_possible_triangles()
algorithm_functions.print_data()
console_functions.pause_system()