Learners Academy · Query Lab

Python Lab

Five core Python patterns, assembled live from your own variable and column names. Fill in the fields, watch the code — and the logic behind it — take shape.

Variables & Types Name a value, Python infers the rest

Python doesn't ask you to declare a type up front — it looks at the value on the right of the = and figures out what kind of thing it's holding.

Loops Repeat, with a running variable

A for loop walks through a sequence one item at a time. A while loop keeps going as long as a condition holds — you control when it stops.

Functions Name a block, reuse it anywhere

A function packages up a piece of logic under a name, with inputs (parameters) and an output (the return value) — write it once, call it as many times as you need.

List Comprehensions A loop and a filter, in one line

A list comprehension builds a new list by transforming each item from an existing one — optionally keeping only the items that pass a condition.

Pandas Basics Load, filter, summarize

A DataFrame is a table in memory. Most everyday work is three moves: read the data in, filter down to the rows you care about, and summarize a column.