Your first cell: Python right in the browser
O que você vai aprender
- run Python right on the lesson page — nothing to install
- create variables and read code line by line: line → what Python did → what is now in memory
- print results with
print - compute turnover, conversion and a remainder — and call each number by its honest name
The investigator's tool
SQL pulls data out of a database. Python helps with everything else: gluing tables together, computing metrics, drawing charts, hunting anomalies. SQL can do some of this too — the tools overlap, and that is fine.
Here Python runs right in the browser: the same machine that opened this page executes your code. Nothing to install, nothing to break.
"A bear has moved into my archive. A panda, to be precise. Get used to her — she will be fetching your tables. But not today." — QUERY

This lesson takes three things as its foundation: variables, arithmetic and print. Everything else — lists, loops, how functions work — waits for chapter 2, and not before these three feel ordinary.
We will read code by one scheme, worth memorizing:
line of code → what Python did → what is now in memory → what got printed
Start with a three-line cell. Press Run.
What happened, line by line
Python executes code top to bottom, one line at a time: it reads a line, does what it says, moves on.
Line 1: orders = 1284
- what Python did: put the number
1284in memory and hung the labelorderson it; - what is now in memory:
orders → 1284; - what got printed: nothing. Assignment is silent — the first thing that surprises beginners.
The = sign here is not mathematical equality. Read it as an arrow right to left: "take the value on the right and remember it under the name on the left". A name with a value is called a variable.
Line 2: print(orders)
- what Python did: looked at what lies under the label
ordersand printed it; - what is now in memory: unchanged —
printonly reads; - what got printed:
1284.
Line 3: print('Orders on March 14:', orders)
- what Python did: printed two values separated by a space — first the quoted text, then the variable's value;
- what got printed:
Orders on March 14: 1284.
About the quotes: quoted text is something Python does not try to understand, it prints it literally. So print(orders) prints 1284, while print('orders') would print the word orders. That is exactly the day-one mistake everyone makes.
print is the output command: everything passed inside the parentheses, comma-separated, lands on screen separated by spaces. Strictly it is a function, and what a function is comes in chapter 2; for now treat it as a "show me" button.
And last: memory lives until the end of the cell. The variable from line 1 is available on every line below — every calculation rests on that.
print only reads it.A variable is a label, not a box
The second assignment did not create a second variable. It moved the label orders onto a new number:
after line 1: orders → 1284
after line 4: orders → 1301 (the old value is gone)
The old value disappears without a trace — if you still need it, you had to keep it under a different name: orders_yesterday = 1284, orders_today = 1301.
That is why variable names matter more than they seem on day one: a, b, x1 will baffle even their author a week later, while orders_today reads itself. The rules in this course are simple: Latin letters, digits and underscores, never start with a digit, no spaces — hence avg_check, not avg check.
Now let us compute something meaningful — on an example where it is easy to lie to yourself.
Turnover is not revenue
The average check is the average amount of one order. Multiply it by the number of orders:
1284 orders × 730 ₽ = 937,320 ₽
What is that number? The temptation to call it "revenue" is enormous — and it is the course's first terminology trap.
937,320 ₽ is turnover, also known as GMV (gross merchandise value): the total value of all orders that passed through the platform. Buyers did pay that money — but they paid it to the sellers, not to Kotomarket.
Kotomarket is a marketplace: it does not own the food and the beds, it matches sellers with buyers. Its own money is the commission on each order, plus ad and paid-delivery income. At a 12% commission the platform's revenue for that day is:
937,320 ₽ × 0.12 ≈ 112,478 ₽
Nearly an eightfold gap. Mixing these numbers up in a report is not a slip of the tongue — it is a different business.
| Number | What it means | On our day |
|---|---|---|
| Turnover (GMV) | what buyers paid for goods | 937,320 ₽ |
| Marketplace revenue | what the platform got out of it (commission) | ≈ 112,478 ₽ |
| Profit | what is left after all costs | smaller still, and a separate conversation |
For an ordinary shop selling its own goods, turnover and revenue coincide — no confusion there. It appears exactly where an intermediary appears: a marketplace, a ride aggregator, a delivery service.
L., entry #8: "The board was shown a slide reading 'revenue 2.3M a day'. That was GMV. The commission is 280 thousand, and the whole company lives on it. Nobody corrected it. I did. I was asked not to spoil the mood."
Arithmetic and comments
Comments. Everything after # to the end of the line is skipped by Python — a note for humans. In commission_rate = 0.12 # platform commission, 12% the variable names the number and the comment names the unit. Both labels are free and both save you a month later.
Arithmetic. Four signs cover nearly everything an analyst needs:
| Sign | Operation | Example |
|---|---|---|
* | multiply | 1284 * 730 → 937320 |
/ | divide | 75 / 1000 → 0.075 |
+ | add | 1284 + 17 → 1301 |
- | subtract | 200 - 17 → 183 |
Precedence is the ordinary school one: * and / first, then + and -, parentheses above all. (1412 - 41) * 695 and 1412 - 41 * 695 are two very different numbers.
Computation inside an assignment. The line gmv = orders * avg_check runs in two beats: Python first computes the right-hand expression (1284 * 730 → 937320) and only then hangs the label gmv on the result. What sits in memory afterwards is a number, not a formula: change orders later and gmv will not recompute itself.
round(...) rounds to a whole number: round(112478.4) → 112478.
Three patterns you already know
Five cells — and you hold three calculations that half of analytics is built from:
product: gmv = orders * avg_check 'how much in total'
share: conversion = buyers / visitors * 100 'what fraction'
remainder: delivered = shipped - lost 'how many are left'
In chapter 1 the same three formulas apply to DAU, funnels and — only the variable names change.
Now the assignments. They work like this: you finish the code in the cell and press the button — the system runs your code and checks the result, and if it does not add up it tells you what is off. Being wrong is fine: unlimited attempts, and a hint is right there.
0 stub with a formula and compute the day's turnover (GMV) into the variable gmv.gmv— the day's turnover;revenue— Kotomarket's revenue (the commission on turnover);conversion— order conversion, in percent.
Principais pontos
- Python here runs right in the browser — nothing to install
- Python reads code top to bottom;
name = valueputs a value in memory under a label, a second assignment moves the label - assignment is silent,
print(...)prints; quoted text prints literally, an unquoted name prints its value #starts a comment; in an assignment the right-hand side is computed first, then the result lands in the variable- three calculation patterns: product ("how much in total"), share ("what fraction"), remainder ("how many are left")
- turnover (GMV) = orders × average check is the buyers' money; a marketplace's revenue is the commission on that turnover, and it is many times smaller
The prologue is closed. Next — chapter 1: DAU, funnels, , and the first case from L.'s journal.