Week 5: String Predicates and Equality Checks

218 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 5: String Predicates and Equality Checks > **Course:** Jan 2026 - Python > **Focus:** Reading constraints on strings, then comparing structured data carefully. --- ## 1.

Visual strip

Relevant recall pieces for this note

Open gallery

Week 5: String Predicates and Equality Checks

Course: Jan 2026 - Python Focus: Reading constraints on strings, then comparing structured data carefully.

1. Core idea

Week 5 is about deciding whether something satisfies a rule, and whether two structured objects are exactly equal.

What to remember

  • Predicate functions should return True or False.
  • A valid word check often means:
    • no spaces,
    • first character uppercase,
    • remaining characters lowercase.
  • Matrix equality needs both shape and element-by-element matching.
  • List equality is order-sensitive.

2. Common traps

  • Checking only size is not enough.
  • Checking only membership is not enough.
  • If one mismatch is found, return False immediately.
  • A recursive equality function still needs a base case.

3. Speedrun pattern

When you see a Week 5 question, ask:
  1. Is this a validator or a comparator?
  2. Does the structure have to match exactly, or only loosely?
  3. Can I stop as soon as the first mismatch appears?

4. Micro revision

  • Predicate = returns Boolean
  • Equality = same shape + same values + same order
  • Early exit is your friend

Assignment anchor

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.