1- def convert_word (word : str ) -> str :
1+ def to_title_case (word : str ) -> str :
22 """
33 Converts a string to capitalized case, preserving the input as is
44
5- >>> convert_word ("Aakash")
5+ >>> to_title_case ("Aakash")
66 'Aakash'
77
8- >>> convert_word ("aakash")
8+ >>> to_title_case ("aakash")
99 'Aakash'
1010
11- >>> convert_word ("AAKASH")
11+ >>> to_title_case ("AAKASH")
1212 'Aakash'
1313
14- >>> convert_word ("aAkAsH")
14+ >>> to_title_case ("aAkAsH")
1515 'Aakash'
1616 """
1717
@@ -31,27 +31,24 @@ def convert_word(word: str) -> str:
3131 return word
3232
3333
34- def to_title_case (input_str : str ) -> str :
34+ def sentence_to_title_case (input_str : str ) -> str :
3535 """
3636 Converts a string to title case, preserving the input as is
3737
38- >>> to_title_case ("Aakash Giri")
38+ >>> sentence_to_title_case ("Aakash Giri")
3939 'Aakash Giri'
4040
41- >>> to_title_case ("aakash giri")
41+ >>> sentence_to_title_case ("aakash giri")
4242 'Aakash Giri'
4343
44- >>> to_title_case ("AAKASH GIRI")
44+ >>> sentence_to_title_case ("AAKASH GIRI")
4545 'Aakash Giri'
4646
47- >>> to_title_case ("aAkAsH gIrI")
47+ >>> sentence_to_title_case ("aAkAsH gIrI")
4848 'Aakash Giri'
4949 """
5050
51- words = input_str .split ()
52- title_case_str = [convert_word (word ) for word in words ]
53-
54- return " " .join (title_case_str )
51+ return " " .join (to_title_case (word ) for word in input_str .split ())
5552
5653
5754if __name__ == "__main__" :
0 commit comments