File tree 1 file changed +6
-5
lines changed 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,25 @@ def convert_word(word):
19
19
"""
20
20
Convert the first character to uppercase if it's lowercase
21
21
"""
22
- if 'a' <= word [0 ] <= 'z' :
22
+ if "a" <= word [0 ] <= "z" :
23
23
word = chr (ord (word [0 ]) - 32 ) + word [1 :]
24
24
25
25
"""
26
26
Convert the remaining characters to lowercase if they are uppercase
27
27
"""
28
28
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 :]
31
31
32
32
return word
33
33
34
34
words = input_str .split ()
35
35
title_case_str = [convert_word (word ) for word in words ]
36
36
37
- return ' ' .join (title_case_str )
37
+ return " " .join (title_case_str )
38
+
38
39
39
40
if __name__ == "__main__" :
40
41
from doctest import testmod
41
42
42
- testmod ()
43
+ testmod ()
You can’t perform that action at this time.
0 commit comments