commit some shii

This commit is contained in:
2025-12-16 07:28:59 +01:00
parent 2c92baa9c8
commit 7daa295db1
9 changed files with 9189 additions and 2 deletions

28
csv/üben1/main.py Normal file
View File

@@ -0,0 +1,28 @@
# -*- coding: ansi -*-
import csv
seen = []
fieldnames = ["Name", "Bundesland", "Flaeche", "Maximale Seetiefe", "Seevolumen", "Anzahl"]
with open("seen.csv", newline="", encoding="ansi") as csvfile:
reader = csv.DictReader(csvfile, delimiter=';', fieldnames=fieldnames)
for row in reader:
row['Flaeche'] = float(row['Flaeche'].replace(',', '.'))
row['Maximale Seetiefe'] = float(row['Maximale Seetiefe'].replace(',', '.'))
row['Seevolumen'] = float(row['Seevolufmen'].replace(',', '.')) if row['Seevolumen'] else 0
seen.append(row)
anzahl_seen = len(seen)
gesamtflaeche = sum(s['Flaeche'] for s in seen)
tiefster_see = max(seen, key=lambda s: s['Maximale Seetiefe'])
durchschnittstiefe = sum(s['Maximale Seetiefe'] for s in seen) / anzahl_seen
print(f"Anzahl der Seen: {anzahl_seen}")
print(f"Gesamtfl<EFBFBD>che: {gesamtflaeche:.2f} km<6B>")
print(f"Tiefster See: {tiefster_see['Name']} mit {tiefster_see['Maximale Seetiefe']} m")
print(f"Durchschnittliche Tiefe: {durchschnittstiefe:.2f} m\n")
print("Liste aller Seen mit Bundesland:")
for s in seen:
print(f"{s['Name']} ({s['Bundesland']})")