Exercise 2: A Fourth Extracted Condition — Possible Solution ==================================================================== THE ADDED CONDITION ------------------------------ def is_eligible_bad(user): if (user['age'] >= 18 and user['country'] == 'US' and user['verified'] and user['has_valid_payment_method']): return True return False def is_eligible_good(user): is_adult = user['age'] >= 18 is_us_resident = user['country'] == 'US' is_verified = user['verified'] has_valid_payment_method = user['has_valid_payment_method'] return is_adult and is_us_resident and is_verified and has_valid_payment_method A user who fails ONLY the new payment condition: {'age': 25, 'country': 'US', 'verified': True, 'has_valid_payment_method': False} RESULTS ------------------------------ BAD version - only tells you the final answer: is_eligible_bad: False GOOD version - each condition independently inspectable: is_adult: True is_us_resident: True is_verified: True has_valid_payment_method: False -> immediately clear the ONLY failing condition is has_valid_payment_method Full agreement check across 5 cases (the original 4 plus this one): bad=True, good=True, match=True bad=False, good=False, match=True bad=False, good=False, match=True bad=False, good=False, match=True bad=False, good=False, match=True ALL match: True Both versions still agree on every case after the fourth condition is added, and the extracted version still isolates exactly which single condition caused a rejection - now correctly pointing at payment method instead of age, country, or verification status. WHY THIS WORKS AS AN ANSWER ------------------------------ The chapter's own debugging finding for the original three conditions - that Extract Variable makes the specific failing condition visible - holds without modification as a fourth condition is added. The benefit doesn't degrade as the expression grows; if anything it becomes more valuable, since a four-way compound boolean is harder to mentally re-evaluate by hand than a three-way one, and the bad version still offers no way to do it at all.