Skip to content

Commit

Permalink
[Units] Improve capwords function formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Jul 6, 2023
1 parent 12d004c commit b5f4e33
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions units/trivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
def capwords(string):
"""string.capwords with abbreviation handling"""
return ' '.join(
word.upper() if word.count('.') > 1 and not word.endswith("..")
or word.upper() in ("TV", "DC-3")
word.upper() if (
word.count('.') > 1 and not word.endswith("..")
or word.upper() in ("TV", "DC-3")
)
else word.capitalize()
for word in string.split()
)
Expand Down

0 comments on commit b5f4e33

Please sign in to comment.