DynamicVibePython learning
How to study · reference & help

One lesson at a time

Read the idea, then follow the named exercise steps. On a phone, use Idea, Code and Output to switch views. Review days begin with recall before the rebuild. A self-review mark is not a scored answer.

Run, inspect, repair

Run loads Python in your browser on the first use, so you need an internet connection. Read Output and the check result. Stop interrupts a run; it keeps your code. Reset restores the selected starter, replacing that exercise’s draft. Use an authored hint before asking for help.

Keep your work

Code drafts, progress and Notes save on this device when browser storage is available. They do not sync through your login. Use Backup & records above to download saved learning records, preview an import or undo the latest import. Copy unsaved text first; clearing browser data can remove local work. A save warning means you should copy your work before leaving.

Practice files and reports

Each browser Run starts in a fresh temporary workspace. A sample file exists only when that run’s code creates it; these are not your computer’s files. On report tasks, use Preview to inspect the actual text and Download to request a copy before another Run, Reset, exercise change or leaving. Reports do not save through tutor login. Read files and write reports.

Get tutoring when you need it

Lessons and checkpoints do not need tutor login. Unlock the tutor through Training’s shared tutor access, then use its return link to come back here. Your question is only sent when you press Send. Do not paste passwords or private production data.

Python words in plain language

Assignment and type
frames = 96 binds a name to an integer. "96" is text, not the same numeric value. Values and names.
List and index
A list keeps items in order. Positions start at zero; the final nonnegative index is length minus one. List lookups.
Loop and indentation
A for loop processes each item. Indentation groups its repeated statements; a statement outside the block runs separately. Loops.
Parameter, argument and Return
A parameter names an input in a definition; an argument supplies its value in a call. Return gives a result to the caller; print displays it. A function that only prints returns None. Functions.
Dictionary and schema
A dictionary labels values with keys. A schema states the required fields and types; a missing fact is not automatically zero. Dictionaries · Validation.
File, CSV and JSONL
A file stores bytes/text. CSV needs a quoting-aware parser; JSONL contains one JSON value per line. Browser practice files are temporary, not computer files. CSV · JSONL.
Denominator and evidence
A rate divides a count by its declared eligible total. Keep exclusions visible. A quiz score, practical check and self-review are different evidence. Quality rates.

Read the error, then make one repair

SyntaxError / IndentationError
Python could not parse the code. Inspect the named line and the preceding line for a missing colon, unmatched quote/bracket or inconsistent indentation. Review blocks.
NameError
A name has no value here. Compare case and spelling, and check that assignment happens before use. Do not replace an unknown parameter with a fixed sample.
TypeError / ValueError
A wrong kind of value or an unacceptable value can fail an operation. Inspect the supplied input and declared policy; do not broadly suppress the error. Narrow error handling.
IndexError / KeyError
The requested position or key is missing. Inspect the collection and interface instead of guessing a fallback. Indices · Keys.
Run stays loading / runtime or checker unavailable
This is not proof that your answer is wrong. Stop if available, copy your draft, check your connection and retry. If it repeats, keep the visible error and use the readable lesson/hints. Never reset or clear browser storage as the first repair.
Expected sample prints, but a check fails
Read the named contract and test changed/empty inputs. The helper may return None, use a fixed value or stop too early even when the sample looks right. A failed check is not a request to copy the expected output.

Press Escape while working inside this panel to close it and return focus to its summary. Without JavaScript, use the summary again. For local Studio commands, use terminal troubleshooting.

← Route Week 3 · Day 15 · Checkpoint

Data review

Loading today's steps…
Lesson idea Tap to fold
Recall — one from each day

Name the method that removes outside spaces, the container with labelled keys, the method that cuts on a separator, and the exception raised by int("unknown").

Show the answer

strip(), a dictionary, split(), and ValueError.

Today

Defend the record contract on unfamiliar data

A useful parser returns data the caller can inspect, not just a report that looks right. Revisit cleaning, splitting, integer conversion and dictionaries together. The two-field example below assumes a valid number; ValueError remains visible if that precondition is broken.

The rebuild preserves the two-field function’s contract. The repair uses a separate error boolean because frames 0 could mean either valid zero or its labelled fallback. The final independent task introduces a new, explicit three-field policy: None means no accepted record, while a valid dictionary can contain zero.

Before the transfer, note four tools: len(parts) counts fields; isinstance(line, str) checks the argument’s type; raise TypeError exposes a wrong caller type; status in ("approved", "review", "hold") tests membership. Return None for malformed strings, not for unrelated caller mistakes.

# Return data from a valid two-field example.
def parse_shot(line):
    parts = line.strip().split("|")
    return {"name": parts[0].strip(),
            "frames": int(parts[1])}


# Keep reporting at the caller.
shot = parse_shot("  Museum | 0  ")
print(shot["name"], "·", shot["frames"], "frames")

The report is Museum · 0 frames. A dictionary with integer zero is a valid result. It is different from None, which the new transfer policy uses to mean no accepted record.

Trace, rebuild and repair before tackling the new three-field parser. Then use the scored checkpoint to identify concepts to revisit; the score does not award the practical check.

Predict, explain, then test

These three brief checks are self-reviewed, not a scored quiz. Explain your answer before opening the comparison. Coding checks test the stated data contract on unfamiliar inputs.

Trace the return

What must a parser return so its caller can inspect frames numerically?

Compare your answer · self-reviewed

A dictionary containing an integer frames value. A printed line or a dictionary with string frames is not equivalent.

Read error evidence

A repair helper returns frames 0 for both valid zero and failed conversion. Which field distinguishes them?

Compare your answer · self-reviewed

The separate error boolean. Testing the count alone would wrongly discard a valid zero.

Defend a new policy

Why return None for malformed text but raise TypeError for a non-string call in the transfer task?

Compare your answer · self-reviewed

Malformed text is an expected data failure under this policy. A non-string argument violates the function API; hiding that mistake as a skipped row makes debugging harder.

Independent transfer: a safe record parser

Write parse_record(line) for the simple training format name|frames|status. This is not quoted CSV. Apply these rules in your own implementation:

  1. Accept a string; raise TypeError for any other argument type.
  2. Require exactly three fields. Trim their outside whitespace and preserve the name’s case.
  3. Require a nonempty name. Convert frames with int(); accept zero, but reject negative counts.
  4. Lowercase status and allow only approved, review or hold.
  5. Return a dictionary with name, integer frames and status for valid data. Return None for malformed strings.
  6. Catch the expected ValueError close to conversion. Do not hide caller errors with a broad exception handler.

Select this task in the exercise controls. The checkpoint link opens its brief and selects its unfinished starter; it never runs Python or awards a pass for you. Review narrow exception handling if needed.

Read the unfinished starter without running Python
# Parse a new three-field record from this brief.
def parse_record(line):
    # Replace this unfinished return with your parser.
    return None


# Report the valid result, then an invalid row.
shot = parse_record("  Museum | 0 | APPROVED  ")
if shot is not None:
    print(shot["name"], "·", shot["frames"], "·",
          shot["status"])
else:
    print("Skipped bad row")
print(parse_record("Canal|many|hold"))

Sample output: Museum · 0 · approved, then None on a separate line. The checks try new names, whitespace, zero, missing/extra fields, invalid numbers and wrong caller types. Quiz scores and this practical evidence are separate.

Now

Choose an exercise to load its prompt.

day-15.py standard Python · runs in this browser
Output

Loading exercises…


    
    

Section 3 checkpoint

Answer five questions, then review the explanations and targeted refresher links. The quiz does not award the independent parser check, and tutor login is not required.

AI Tutor

The tutor mounts here when JavaScript is available. The lesson above stays readable without it.