Guided pathThis is part of Understand Transformers & BERTBack to the path

True / false and simple comparisons

P40.text-and-numbers.03 · Audience: guest, language-pro, it-ml · Prerequisites: Text (strings)

Real LLM grading for this pageLLM grading (this page):

Look at a word and decide, by eye: is it longer than five letters? That yes-or-no judgement is something you make constantly. This module shows how Python answers the same yes-or-no questions for you — one kind of comparison at a time.

Step 1 / 3A yes-or-no answer (boolean)
ⓘ Concept: Comparing gives True or False
A boolean is one of just two values: True or False. You get one by comparing with > and < (bigger / smaller): len(word) > 5 asks "is this word longer than five letters?" and hands back True or False.

Why it matters — Every later automation — 'keep the long words', 'skip the empty lines' — rests on a yes-or-no test. Naming True and False now makes those choices readable later.

Ask the mentor about this module

Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.

Ctrl/Cmd + Enter to send

🎓 Practice ladder

1 graded rung · ~4 min

Your turn: judge two words — is one longer than five letters, is the other exactly three, and are both true at once? Write the comparisons you just stepped through, then press Run.

Explorer rung — is this word long?

Loading exercise…

Where next?