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