Комментарии:
in title() method, white spaces and punctuation marks (, . : ; ? ! ) are used to split sentence into words and then capitalize the first letter of each word. In capwords() method, only white spaces are used to split sentence. That's the reason why in some cases the outputs from title() and capwords() methods are different.
ОтветитьTy! Helped me on codewars
ОтветитьThis explains everything on a very basic level and I feel like I am learning a lot from this. Thank you for your video :)
ОтветитьI like your way of solving this problem by split the string by spaces and then joining them back together. Mine was to find the spaces in the string but it didn't work well. Beautiful approach!
ОтветитьOH yeah! I usually used title() method to capitalize words and couldn't work out why in some cases it didn't work. It's because of the punctuation marks as you explained. Good point!
ОтветитьAwesome! So simple and to the point explanation :)
ОтветитьI love the way you encourage us to reproduce the inbuilt function with your own function. Good way to practice and improve skill
Ответить