Skip to content

Commit

Permalink
Merge branch 'master' into python-dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brendaweles authored Dec 2, 2024
2 parents 75c5f15 + bd032b2 commit 0f93296
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 0f93296

Please sign in to comment.