From 034d6883bfe455569dafc061affcb14068a96d98 Mon Sep 17 00:00:00 2001 From: hamx Date: Tue, 3 Dec 2024 23:01:46 +0100 Subject: [PATCH] little fix --- aproksymacja/main.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/aproksymacja/main.py b/aproksymacja/main.py index ce7d4a9..e5e8573 100644 --- a/aproksymacja/main.py +++ b/aproksymacja/main.py @@ -7,25 +7,20 @@ import random as rand def print_table(*columns, result): headers = ["Lp.", "x0", "x1", "x2", "x0y", "x1y"] - # Combine headers and columns to calculate max width for each column max_widths = [ max(len(str(cell)) for cell in [header] + list(column)) for header, column in zip(headers, columns) ] - # Function to format a row def format_row(row): return " | ".join(f"{str(cell).ljust(width)}" for cell, width in zip(row, max_widths)) - # Print header print(format_row(headers)) print("-" * (sum(max_widths) + 3 * (len(headers) - 1))) # Separator line - # Print rows for row in zip_longest(*columns, fillvalue=" "): print(format_row(row)) - # Print result at the bottom print("-" * (sum(max_widths) + 3 * (len(headers) - 1))) print(", ".join(result), end="\n\n") @@ -71,7 +66,7 @@ a0 = a0(a1) print(f"a0 = {round(a0, 2)}, a1 = {round(a1, 2)}") - +# rysowanie funkcji i punktów plt.xlabel('oś x') plt.ylabel('oś y') plt.title('Aproksymacja - MNK')