has_account = True
password_ok = True
if has_account:
if password_ok:
print("Welcome")Line-by-line explanation
- Two facts are stored.
- The outer if first checks for an account.
- The inner if is indented inside the outer block.
- Welcome appears only when both checks succeed.
Use nesting when the second question only makes sense after the first. For two simple facts, and may be clearer.