Skip to content

Commit e589293

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b331992 commit e589293

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

strings/title.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@ def convert_word(word):
1919
"""
2020
Convert the first character to uppercase if it's lowercase
2121
"""
22-
if 'a' <= word[0] <= 'z':
22+
if "a" <= word[0] <= "z":
2323
word = chr(ord(word[0]) - 32) + word[1:]
2424

2525
"""
2626
Convert the remaining characters to lowercase if they are uppercase
2727
"""
2828
for i in range(1, len(word)):
29-
if 'A' <= word[i] <= 'Z':
30-
word = word[:i] + chr(ord(word[i]) + 32) + word[i+1:]
29+
if "A" <= word[i] <= "Z":
30+
word = word[:i] + chr(ord(word[i]) + 32) + word[i + 1 :]
3131

3232
return word
3333

3434
words = input_str.split()
3535
title_case_str = [convert_word(word) for word in words]
3636

37-
return ' '.join(title_case_str)
37+
return " ".join(title_case_str)
38+
3839

3940
if __name__ == "__main__":
4041
from doctest import testmod
4142

42-
testmod()
43+
testmod()

0 commit comments

Comments
 (0)