random/rand.py

51 lines
1.5 KiB
Python

from colorama import init, Fore
import os
import function
init(autoreset=True)
os.system("cls")
masive = [] # инициализация основного масива
show_graph = None # параметр базового вывода графика
show_graph = function.graf(show_graph)
max_or_mean = None # параметр типа графика
max_or_mean = function.type_graf(show_graph, max_or_mean)
num_cols = None # параметр кол-ва столбцов таблице
num_cols = function.num_column(num_cols)
while True:
try:
masive = function.rand() # заполнение массива случайными числами
match show_graph:
case "yes":
function.print_table(masive, num_cols)
max_height = max(masive)
length = len(masive)
if max_height > 20 or length > 20:
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
breaker, show_graph, max_or_mean, num_cols = function.menu(
show_graph, max_or_mean, num_cols
)
if breaker == False:
break
# ВСЁ ГОТОВО)