Programutvikling
-hva handler det om?
with open("../demo/bm_results2012.txt") as f:
lines = f.readlines()
with open("../demo/bm_results2012.txt") as f:
lines = f.readlines()
for line in lines:
line_parts = line.split(","")
Beregninger
Bruk funksjoner fra Python Standard Library
(se W3Schools - Built in functions)
avgerage_age = sum(ages)/len(ages)
Presentasjon
Skrive ut
- til skjerm
- til fil
with open("report.txt", "w") as f:
f.write(f"Gjennomsnittsalder i Boston Marathon: {average_age:>5.1f}")