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 1 · Day 4 of 40

Functions

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

What tells Python which lines are inside a loop?

Show the answer

Answer. The indent — the four spaces at the start of the line. Python uses that spacing instead of brackets.

Today

Return a reusable result

Your outcome: Define and call a function whose parameters control the result, including new names and zero frames.

def names a function and describes its parameters. Defining it does not execute its body. Calling frames_to_seconds(240) supplies 240 to the parameter frames for that call.

return hands a value to the caller and ends that call. print only displays a value. A function that only prints and reaches its end returns None. Keep display outside the helper so the caller can calculate with the returned number.

The / operator divides and produces a floating-point result: 240 / 24 is 10.0. This exercise declares a fixed rate; the 25-fps variant changes that denominator once inside the helper. It does not analyze a clip or discover its actual rate.

A function can receive two parameters, separated by a comma. To build slate text with +, convert the numeric frame count with str(frame_count) first. str makes display text without changing the caller’s integer. Either quote style is fine; a correct function need not match the example source.

# Return a reusable result
def frames_to_seconds(frames):
    return frames / 24

seconds = frames_to_seconds(240)
print(seconds)
print(frames_to_seconds(96))

def slate_line(name, frames):
    return name + " · " + str(frames) + " frames"

print(slate_line("Canal", 48))

Trace: The first definition creates a callable. The first call returns 10.0 to seconds, then print displays it. The second call returns 4.0. The two-parameter slate call returns Canal · 48 frames.

Explain the call, parameter and returned value separately. Change both call inputs; do not call a copied output proof of a reusable function.

Predict, explain, then test

Answer before opening the comparison. These brief answers are self-reviewed, not quiz scores. Task labels describe the brief, not proof that you worked without assistance. Record any examples, hints or tutor help in your own Notes.

Predict

What does frames_to_seconds(0) return at 24 fps?

Compare your answer · self-reviewed

0.0, a numeric zero. No frames is not a NameError or an absent return.

Explain

Why does a helper that only prints a slate fail when the caller needs its returned text?

Compare your answer · self-reviewed

It returns None, not the printed string. The caller’s print could then show an extra None. Return the text and print it at the outer boundary.

Repair

The parameter is frames, but the return uses an undefined count. What is the reusable repair?

Compare your answer · self-reviewed

Use the supplied parameter in the calculation. Replacing count with a fixed sample such as 96 only works for that sample.

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-4.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.