Skip to content

Add python-conditional-statements materials folder - #950

Merged
realpython-bot merged 1 commit into
masterfrom
maintenance/python-conditional-statements-20261123
Nov 23, 2026
Merged

realpython-bot merged 1 commit into
masterfrom
maintenance/python-conditional-statements-20261123

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds the code examples for Conditional Statements in Python. The tutorial didn't have a folder yet, while its series neighbors (python-program-structure, python-while-loop, python-for-loop) do.

  • One script per tutorial section, plus foo.py and blocks.py as shown in the article. REPL echoes become print() / repr() calls.
  • The one-line if examples, the blocks.py comment table, and the chained conditional expression keep the article's layout under # fmt: off, because the layout is what they demonstrate.
  • The empty-block IndentationError example can't run, so it isn't reproduced. pass_statement.py is the fixed version.

Verified: every script ran on CPython 3.14.10, and each one's output matches the article. ruff@0.14.1 format --check, ruff check, and dircheck.py all pass.

This is part of the maintenance update of the article (draft: https://realpython.com/pbjt/blog/post/2382/change/, card: https://trello.com/c/zABgJG50). The article's python-conditional-statements-code opt-in points at this folder, so this PR needs to merge before the update goes live. Reviewed with Martin Breuss.

🤖 Generated with Claude Code

Code examples for Conditional Statements in Python, one script per section,
verified on Python 3.14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realpython-bot
realpython-bot merged commit 9b8011b into master Nov 23, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/python-conditional-statements-20261123 branch November 23, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant