random/rand.py

51 lines
1.5 KiB
Python
Raw Permalink Normal View History

2023-03-06 19:00:40 +00:00
from colorama import init, Fore
import os
import function
init(autoreset=True)
os.system("cls")
2023-03-06 20:46:43 +00:00
masive = [] # инициализация основного масива
2023-03-06 19:00:40 +00:00
2023-03-06 20:46:43 +00:00
show_graph = None # параметр базового вывода графика
2023-03-06 19:00:40 +00:00
show_graph = function.graf(show_graph)
2023-03-06 20:46:43 +00:00
max_or_mean = None # параметр типа графика
2023-03-06 19:00:40 +00:00
max_or_mean = function.type_graf(show_graph, max_or_mean)
2023-03-06 20:46:43 +00:00
num_cols = None # параметр кол-ва столбцов таблице
2023-03-06 19:00:40 +00:00
num_cols = function.num_column(num_cols)
while True:
2023-03-06 20:46:43 +00:00
try:
masive = function.rand() # заполнение массива случайными числами
2023-03-06 19:00:40 +00:00
match show_graph:
case "yes":
function.print_table(masive, num_cols)
max_height = max(masive)
length = len(masive)
2023-03-06 20:46:43 +00:00
if max_height > 20 or length > 20:
2023-03-06 19:00:40 +00:00
function.percentage_graph(masive, max_or_mean)
else:
function.real_graph(masive)
input()
case "no":
function.print_table(masive, num_cols)
input()
except ValueError:
os.system("cls")
print(Fore.RED + "Приятель, внимательнее! \nЗаново!")
continue
2023-03-06 20:46:43 +00:00
breaker, show_graph, max_or_mean, num_cols = function.menu(
show_graph, max_or_mean, num_cols
)
2023-03-06 19:00:40 +00:00
if breaker == False:
break
2023-03-06 20:46:43 +00:00
# ВСЁ ГОТОВО)