Decide if a deploy is allowed
Problem statement
Real deploy rules are rarely a single check, they're usually several conditions combined: tests must have passed, AND (it's not a freeze window OR someone manually approved an override). Combining conditions uses and, or, and not, and how they're grouped changes the answer.
Common mistake: relying on default order without parentheses when mixing and and or.
Ambiguous: tests_passed and not freeze_window or overrideand binds tighter than or, so this actually means (tests_passed and not freeze_window) or override, an override can let a deploy through even if tests failed. That might be intentional, or it might not be, the point is you can't tell just by reading it. Parentheses make the intent explicit instead of relying on a rule you have to remember.
Your task: given testsPassed = True, freezeWindow = True, and override = False, print "Deploy allowed" if the deploy should proceed, or "Deploy blocked" otherwise. A deploy proceeds only when tests passed AND (there's no freeze window OR there's an override).
Expected output:
Deploy blockedApproach
Write the rule with explicit parentheses so it matches the English description exactly: testsPassed and (not freezeWindow or override).
tests_passed = True
freeze_window = True
override = False
allowed = tests_passed and (not freeze_window or override)
if allowed:
print("Deploy allowed")
else:
print("Deploy blocked")