Last active
August 30, 2022 13:36
-
-
Save bjelline/4ca2c642ab6e672acd5297cef27196d4 to your computer and use it in GitHub Desktop.
Listen mit Monaten und Daten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
# Zwei Zeilen aus einer csv-Datei lesen: | |
with open('salzburg_daten.csv') as file: | |
reader = csv.reader(file, delimiter=';') | |
monate = next(reader) | |
temperaturen = next(reader) | |
print("Im Monat", monate[0], "ist die durchschnittliche Temperatur", temperaturen[0]) | |
print("Im", monate[11], "ist die durchschnittliche Temperatur", temperaturen[11]) | |
for i in range(0,12): | |
print("Im", monate[i], "ist die durchschnittliche Temperatur", temperaturen[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
temperaturen = [ -2.2, -0.8, 3.4, 8.5 , 13.1, 16.7 , 18.2, 17.9 , 13.6 , 9.2, 3.6 , -0.8 ] | |
monate = [ "Jänner", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ] | |
print("Im Monat", monate[0], "ist die durchschnittliche Temperatur", temperaturen[0]) | |
print("Im", monate[11], "ist die durchschnittliche Temperatur", temperaturen[11]) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 13 in line 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jänner;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember | |
-2,2;-0,8;3,4;8,5;13,1;16,7;18,2;17,9;13,6;9,2;3,6;-0,8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment