Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions how-to-indent-in-python/README.md
Original file line number Diff line number Diff line change
@@ -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/).
17 changes: 17 additions & 0 deletions how-to-indent-in-python/long_indented_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
long_list_of_names = [
"Amy",
"Brian",
"Carol",
"Dennis",
"Emma",
"Frank",
"Georgia",
"Herbert",
"Isabelle",
"Joshua",
"Kimberly",
"Laurence",
"Megan",
"Nicolas",
"Ophelia",
]
8 changes: 8 additions & 0 deletions how-to-indent-in-python/lucky_number.py
Original file line number Diff line number Diff line change
@@ -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.")
12 changes: 12 additions & 0 deletions how-to-indent-in-python/sample_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ruff: noqa
def add(a, b):
answer = a + b

return answer

def sub (c ,
d):

answer = c -d

return answer
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ line-length = 79
exclude = [
".devcontainers",
".github",
"migrations"
"migrations",
"how-to-indent-in-python/sample_code.py"
]

[tool.ruff.lint]
Expand Down