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 2 · Day 8 of 40

Elif

Loading today's steps…
Lesson idea Tap to fold
Recall

Without scrolling back — what tells Python which lines belong to the if block versus the else block?

Show the answer

Answer. The indent — same as a loop. Everything indented under if runs when the condition is True; everything indented under else runs when it's False.

And from further back — what is the difference between print and return?

Show the answer

Answer. print shows something on screen. return hands a value back so it can be used.

Today's one idea

elif adds more forks in a row

if/else only ever gives you two paths. Most real decisions have more than two — a QC pass doesn't just pass or fail, it can also come back with a warning. elif — short for "else if" — chains extra forks in between:

# Set up the values for this step
error_count = 2

# Choose the matching result
if error_count == 0:
    print("Pass")
elif error_count <= 3:
    print("Warning")
else:
    print("Fail")

Python checks each condition top to bottom: is error_count 0? No. Is it 3 or fewer? Yes — print "Warning", and stop. It never even looks at the else.

Python checks top to bottom and stops at the first True branch — order matters. If error_count were 0, the very first check would already be True, and everything below it — the elif, the else — would never run, even if they'd also have matched.

That means the most specific condition usually belongs first. Put a broad "catch anything" check at the top of the chain by mistake, and every narrower check below it becomes dead code — correct, but unreachable.

That is the whole idea for today. Chain as many elifs as a decision needs; Python runs exactly one branch, the first one that's True.

Predict, explain, then test

These three short checks are self-reviewed, not a quiz score. The code checks below rerun your rule on changed inputs and boundaries. They keep your named input facts and check your rule, not one required quote style.

Predict a boundary

For zero → Pass, up to three → Warning, otherwise → Fail, what happens at three and four?

Compare your answer · self-reviewed

Three is Warning; four is Fail. <= includes the three-error boundary.

Compare chains

Why can two separate if statements print two results at zero errors?

Compare your answer · self-reviewed

Both zero == 0 and zero <= 3 are True. elif connects them so the first matching branch wins.

Explain the order

Why test zero before testing up to three?

Compare your answer · self-reviewed

Zero also satisfies the broader warning condition. If that condition comes first, the specific Pass branch is never reached.

Now

Choose an exercise to load its prompt.

Go deeper — optional

Today's idea in two other voices, if you want one. Not required — the exercises above are the actual lesson.

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

Loading exercises…


    
    
AI Tutor

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