Skip to content

Commit

Permalink
Merge branch 'django-user-management' of github.com:realpython/materi…
Browse files Browse the repository at this point in the history
…als into django-user-management
  • Loading branch information
acsany committed Dec 2, 2024
2 parents fedf431 + d743133 commit 5d5fbf7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
6 changes: 2 additions & 4 deletions name-main-idiom/echo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
def echo(text: str, repetitions: int = 3) -> str:
"""Imitate a real-world echo."""
echoed_text = ""
for i in range(repetitions, 0, -1):
echoed_text += f"{text[-i:]}\n"
return f"{echoed_text.lower()}."
echoes = [text[-i:].lower() for i in range(repetitions, 0, -1)]
return "\n".join(echoes + ["."])


if __name__ == "__main__":
Expand Down
6 changes: 2 additions & 4 deletions name-main-idiom/echo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

def echo(text: str, repetitions: int = 3) -> str:
"""Imitate a real-world echo."""
echoed_text = ""
for i in range(repetitions, 0, -1):
echoed_text += f"{text[-i:]}\n"
return f"{echoed_text.lower()}."
echoes = [text[-i:].lower() for i in range(repetitions, 0, -1)]
return "\n".join(echoes + ["."])


def main() -> None:
Expand Down
6 changes: 2 additions & 4 deletions name-main-idiom/echo_demo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
def echo(text: str, repetitions: int = 3) -> str:
"""Imitate a real-world echo."""
echoed_text = ""
for i in range(repetitions, 0, -1):
echoed_text += f"{text[-i:]}\n"
return f"{echoed_text.lower()}."
echoes = [text[-i:].lower() for i in range(repetitions, 0, -1)]
return "\n".join(echoes + ["."])


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions python-f-string/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Python's F-String: An Improved String Interpolation and Formatting Tool
# Python's F-String for String Interpolation and Formatting

This folder provides the code examples for the Real Python tutorial [Python's F-String: An Improved String Interpolation and Formatting Tool](https://realpython.com/python-f-string/).
This folder provides the code examples for the Real Python tutorial [Python's F-String for String Interpolation and Formatting](https://realpython.com/python-f-strings/).

0 comments on commit 5d5fbf7

Please sign in to comment.