KKitForma.

Language

EnglishEnglishTürkçeTurkishDeutschGermanTool unavailable · open catalogEspañolSpanishTool unavailable · open catalogFrançaisFrenchTool unavailable · open catalogPortuguêsPortugueseTool unavailable · open catalogItalianoItalianTool unavailable · open catalogNederlandsDutchTool unavailable · open catalogPolskiPolishTool unavailable · open catalogРусскийRussianTool unavailable · open catalogУкраїнськаUkrainianTool unavailable · open catalogSvenskaSwedishTool unavailable · open catalogNorskNorwegianTool unavailable · open catalogDanskDanishTool unavailable · open catalogSuomiFinnishTool unavailable · open catalogČeštinaCzechTool unavailable · open catalogRomânăRomanianTool unavailable · open catalogΕλληνικάGreekTool unavailable · open catalogالعربيةArabicTool unavailable · open catalogעבריתHebrewTool unavailable · open catalogفارسیPersianTool unavailable · open catalogاردوUrduTool unavailable · open catalogहिन्दीHindiTool unavailable · open catalogবাংলাBengaliTool unavailable · open catalogதமிழ்TamilTool unavailable · open catalogతెలుగుTeluguTool unavailable · open catalogमराठीMarathiTool unavailable · open catalogગુજરાતીGujaratiTool unavailable · open catalog简体中文Chinese SimplifiedTool unavailable · open catalog繁體中文Chinese TraditionalTool unavailable · open catalog日本語JapaneseTool unavailable · open catalog한국어KoreanTool unavailable · open catalogTiếng ViệtVietnameseTool unavailable · open catalogไทยThaiTool unavailable · open catalogBahasa IndonesiaIndonesianTool unavailable · open catalogBahasa MelayuMalayTool unavailable · open catalogFilipinoFilipinoTool unavailable · open catalogKiswahiliSwahiliTool unavailable · open catalogAfrikaansAfrikaansTool unavailable · open catalogMagyarHungarianTool unavailable · open catalogБългарскиBulgarianTool unavailable · open catalogHrvatskiCroatianTool unavailable · open catalogSrpskiSerbianTool unavailable · open catalogSlovenčinaSlovakTool unavailable · open catalogSlovenščinaSlovenianTool unavailable · open catalogLietuviųLithuanianTool unavailable · open catalogLatviešuLatvianTool unavailable · open catalogEestiEstonianTool unavailable · open catalogCatalàCatalanTool unavailable · open catalogEuskaraBasqueTool unavailable · open catalog
← All learning paths

Free learning • no account required

Turn small datasets into checked answers

Three stages teach data representation, functions, edge cases and a reproducible CSV summary using only Python’s standard library.

Write a small study-log summarizer and explain how it handles empty or invalid rows.

Suggested study time: 120 minutes, plus your project. Go at your own pace.

Before you start: prerequisites and scope
  • Read a small table and calculate a mean by hand.
  • For running the examples, use an existing Python 3 installation and a text editor. Reading and quizzes work without installing anything.

This path teaches local files and basic Python. It does not execute Python in this page, cover databases or certify professional competence. No package installation, account or paid API is required.

0/3

Completion means practice acknowledged and every quiz answer correct. It is a personal study record, not certification. All lessons remain available.

Loading this device’s progress…

Restore or reset progress

1. Model one record, then a collection

By the end

  • Distinguish a list from a dictionary.
  • Trace an accumulator through a loop.

A dictionary groups named facts about one session; a list holds the sessions in order. Choose keys with units when that prevents ambiguity. The value 30 means little until the key says minutes rather than hours.

An accumulator starts at zero before the loop and changes once per record. If it starts inside the loop, each iteration forgets the previous total. Trace the values on paper before relying on a printout.

Separate the input representation from the question. The same list can answer total minutes, the longest session or the number above a threshold. Keep the original records unchanged so you can inspect them if the summary looks wrong.

Worked example

Find total minutes for three sessions without changing their records.

  1. Start total at 0 outside the loop.
  2. Add 20, then 35, then 45: the running totals are 20, 55 and 100.
  3. Divide 100 by 3 only after the loop if a mean is needed.
sessions = [
    {"day": "Mon", "minutes": 20},
    {"day": "Tue", "minutes": 35},
    {"day": "Wed", "minutes": 45},
]
total = 0
for session in sessions:
    total += session["minutes"]
print(total)  # 100

The total is 100 minutes. The mean is 100/3, approximately 33.33 minutes; rounding is presentation, not a change to the data.

Try it yourself

Add a zero-minute session. Find the new total, count and mean, then count sessions of at least 30 minutes.

  • Keep the zero-minute row in the count.
  • Use >= 30, so a session of exactly 30 minutes would qualify.
Reveal the practice solution

The total stays 100; count becomes 4; mean is 25. Two sessions qualify (35 and 45). Initialize a separate long_count = 0 and increment it inside an if session["minutes"] >= 30 condition.

Watch for this mistake: A zero is an observed value, not a missing row. Dropping it changes the denominator and the meaning of the mean.

Check your understanding

Choose one answer per question. You can retry without a limit; review the explanation after checking.

1. What is total after values 5, 0 and 8 are accumulated from zero?
2. Which structure best represents one session with named day and minutes fields?

0/2 answered. Answer every question before checking.

Sources and review date

Explanations, examples and quiz questions are original KitForma material. These links support technical facts and curriculum alignment.

Apply it: your final project

Make a study-log summary with columns day and minutes. Produce row count, total, mean and the number of sessions at least 30 minutes long. Preserve the input file and print an understandable error when a row is invalid.

  • For minutes [20, 35, 45, 0], count = 4, total = 100, mean = 25 and long sessions = 2.
  • An empty dataset reports no mean. A missing column or negative/non-integer minute value reports the failing row.
  • Keep the algorithm separate from file reading and write three assert checks for it.

The project is self-reviewed using this rubric; the site does not automatically grade your code or certify mastery.

KitForma

What would you like to do?