Conditionals Trainer

Python: warming up...
Built-in AI tutor. Stuck on a cell? Ask the helper on this page. It coaches against what you have actually run — it does not hand you the answer before you try.

A conditional is the Excel =IF(...) you already know, written in plain Python. =IF(B2>10000,"Large","Small") becomes an if / else. AND() becomes and, OR() becomes or, and a nested IF becomes elif. This is a notebook: each cell has an In[ ] on the left. Type or edit a line, press Shift+Enter (or click Run), and the output appears underneath. Read each Predict card first — guess the answer before you run.

1 · if / else 2 · and 3 · or 4 · elif 5 · on purpose: an error
audio is your voice-clone clips (mp3, no install). "Test sound" checks your speakers.

What you just practiced

You wrote the four shapes of accounting logic in Python: a two-way if / else, a both-must-be-true and, an either-one or, and a three-or-more-way elif ladder. Every one of these is an Excel =IF you have written before — the difference is that the Python version runs once per row inside a loop, on a thousand invoices, without you dragging anything down.

The one rule that trips people up: a single = assigns a value (flag = "Large"), and a double == tests for equality (status == "Open"). Using = where you meant == is the most common conditional bug. The trainer's last cell let you make exactly that error on purpose so the red traceback stops being scary.