From 8ef6dcf2f56508f0f22f29b171a0a6a7afddd827 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 7 Nov 2025 19:23:49 +0100 Subject: [PATCH 1/4] Add materials for the indent tutorial --- how-to-indent-in-python/README.md | 3 +++ how-to-indent-in-python/lucky_number.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 how-to-indent-in-python/README.md create mode 100644 how-to-indent-in-python/lucky_number.py diff --git a/how-to-indent-in-python/README.md b/how-to-indent-in-python/README.md new file mode 100644 index 0000000000..64dec7b6c8 --- /dev/null +++ b/how-to-indent-in-python/README.md @@ -0,0 +1,3 @@ +# How to Properly Indent Python Code + +This folder contains sample code for the Real Python tutorial [How to Properly Indent Python Code](https://realpython.com/how-to-indent-in-python/). diff --git a/how-to-indent-in-python/lucky_number.py b/how-to-indent-in-python/lucky_number.py new file mode 100644 index 0000000000..59897586c0 --- /dev/null +++ b/how-to-indent-in-python/lucky_number.py @@ -0,0 +1,8 @@ +lucky_number = 7 +for number in range(10): + if number == lucky_number: + print("Found the lucky number!") + else: + print(f"{number} is not my lucky number.") + +print("Done.") From 18c7d8f3f226b6915c33435bb2f455db4c8bc66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Zaczy=C5=84ski?= Date: Sun, 9 Nov 2025 19:22:41 +0100 Subject: [PATCH 2/4] Add missing files --- how-to-indent-in-python/long_indented_list.py | 17 +++++++++++++++++ how-to-indent-in-python/sample_code.py | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 how-to-indent-in-python/long_indented_list.py create mode 100644 how-to-indent-in-python/sample_code.py diff --git a/how-to-indent-in-python/long_indented_list.py b/how-to-indent-in-python/long_indented_list.py new file mode 100644 index 0000000000..a452066ab1 --- /dev/null +++ b/how-to-indent-in-python/long_indented_list.py @@ -0,0 +1,17 @@ +long_list_of_names = [ + "Amy", + "Brian", + "Carol", + "Dennis", + "Emma", + "Frank", + "Georgia", + "Herbert", + "Isabelle", + "Joshua", + "Kimberly", + "Laurence", + "Megan", + "Nicolas", + "Ophelia", +] diff --git a/how-to-indent-in-python/sample_code.py b/how-to-indent-in-python/sample_code.py new file mode 100644 index 0000000000..bd6669c896 --- /dev/null +++ b/how-to-indent-in-python/sample_code.py @@ -0,0 +1,12 @@ +# noqa +def add(a, b): + answer = a + b + + return answer + +def sub (c , + d): + + answer = c -d + + return answer From e6e3c31b7028d5ed741b39e8d7ff76d54d749fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Zaczy=C5=84ski?= Date: Sun, 9 Nov 2025 19:24:48 +0100 Subject: [PATCH 3/4] Suppress Ruff --- how-to-indent-in-python/sample_code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/how-to-indent-in-python/sample_code.py b/how-to-indent-in-python/sample_code.py index bd6669c896..ffd40abcd8 100644 --- a/how-to-indent-in-python/sample_code.py +++ b/how-to-indent-in-python/sample_code.py @@ -1,4 +1,4 @@ -# noqa +# ruff: noqa def add(a, b): answer = a + b From 51d00227a8547a82c4f6b1cd6b15826d3c8add8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Zaczy=C5=84ski?= Date: Sun, 9 Nov 2025 19:26:52 +0100 Subject: [PATCH 4/4] Suppress linter for a specific file --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5844cb3150..f70243817e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,8 @@ line-length = 79 exclude = [ ".devcontainers", ".github", - "migrations" + "migrations", + "how-to-indent-in-python/sample_code.py" ] [tool.ruff.lint]