From 237e3f359a10a3d7adf12a30809433e50c005a47 Mon Sep 17 00:00:00 2001 From: Safak Date: Wed, 23 Apr 2025 16:32:15 +0200 Subject: [PATCH] =?UTF-8?q?Entfernen=20redunanter=20Sortierfunktion=20Entf?= =?UTF-8?q?ernen=20nicht=20ben=C3=B6tigter=20Importe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- P1/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/P1/main.py b/P1/main.py index 7b7b315..16a26ad 100644 --- a/P1/main.py +++ b/P1/main.py @@ -1,5 +1,4 @@ import math -from operator import concat empty_element = { "count" : 1, @@ -105,8 +104,8 @@ def calculate(elements, m, message): reverse=True )) # Ausgabe - for x_i in sorted_by_information: - print(f"{elements[x_i]["count"]:3.0f} | {elements[x_i]["I(x_i)"]:15.12f} | »{x_i}«") + for x_i in sorted_by_element: + print(f"{elements[x_i]["count"]:3.0f} | {elements[x_i]["p(x_i)"]:10.7f} | {elements[x_i]["I(x_i)"]:10.7f} | »{x_i}«") print("Entropie der Nachricht = " + h.__str__() + "\n\n") def main():