Module 1 — Truth in Values
Names, numbers, and text: the three things every Python program keeps track of.
3 lessons · about 20 min · difficulty 1 of 5
1. Variables hold your facts
A variable is a name you stick on a value so you can use it later.
In Python you make a variable by writing a name, an equals sign, and a value. There is no special setup word.
Names should say what the value means. `crew_size` tells the next person more than `x` ever will.
Think of it like: A label on a job-site bin. The bin holds the parts; the label tells everyone what is inside.
At NoblePort: NobleHub's Daily Truth Report starts exactly like this: crew_size, job_name, and invoiced_total are named once, then reused in every line of the report so the numbers cannot drift between sentences.
Try it yourself: Rewrite the example using one of your own jobs: a real job name and a real crew size. Then add a `permit_status` variable and print it too.
Common mistake: Naming a value `x` or `data`. Six weeks later nobody — including you — knows whether it held hours, dollars, or a job id.
Why it matters: Every report, invoice, and AI prompt you automate starts with naming the facts clearly.
2. Numbers and text are different
Python treats 4 and "4" as two different things, on purpose.
Numbers can be added, subtracted, and multiplied. Text (a string) can be joined together but not added like math.
Use `int()` and `str()` to move between the two when you need to.
Think of it like: A tape measure versus a shipping label. Both have numbers on them, but only one is meant for math.
At NoblePort: Every glossary import and Airtable export arrives as text. When NobleHub loads crew hours from a spreadsheet, the '8' is a string until something converts it — that conversion is why a day total shows $500.0 instead of an error.
Try it yourself: Change `hours` to the text "8" and run it. Read the error, then fix it with `int(hours)`.
Common mistake: Adding a number to text with `+`. Python refuses; convert with `str()` first, or use an f-string.
Why it matters: Most spreadsheet-to-script bugs are a number that was secretly text.
3. True, False, and the truth code
Booleans are the yes/no answers your program makes decisions with.
A comparison like `total > 400` gives back `True` or `False`.
Empty text, zero, and empty lists all count as False when Python needs a yes or no. Everything else counts as True.
Think of it like: The gate latch on a site fence: it is either open or shut, and everything downstream depends on which.
At NoblePort: A NobleHub governance gate is one boolean at the end of a long chain: `needs_human_approval = amount > 5000 or touches_contract`. If that lands on True, Stephanie.ai stops and waits for a person.
Try it yourself: Write a check that prints 'Gate: human approval' when a change order total is over 5000, and 'Gate: auto-send' otherwise.
Common mistake: Assuming an empty note or a zero is 'something'. In Python both count as False, which can silently skip a check.
Why it matters: Alerts, approvals, and guardrails all come down to one boolean at the end.