Tutorial #13: Convert First Letter Of Each Word In A Sentence To Uppercase - Python for Beginners

Tutorial #13: Convert First Letter Of Each Word In A Sentence To Uppercase - Python for Beginners

Make Everyday EZ Day

1 год назад

7,039 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Make Everyday EZ Day
Make Everyday EZ Day - 08.06.2022 12:03

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.

Ответить
Don Cappuchino
Don Cappuchino - 31.10.2022 18:49

Ty! Helped me on codewars

Ответить
Iska Kuzmin
Iska Kuzmin - 10.07.2022 04:14

This explains everything on a very basic level and I feel like I am learning a lot from this. Thank you for your video :)

Ответить
Tsuda Shiro
Tsuda Shiro - 09.07.2022 02:22

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!

Ответить
Luca Tony
Luca Tony - 04.07.2022 04:39

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!

Ответить
Star Boys
Star Boys - 26.06.2022 15:45

Awesome! So simple and to the point explanation :)

Ответить
Dingo Dingo
Dingo Dingo - 17.06.2022 04:47

I love the way you encourage us to reproduce the inbuilt function with your own function. Good way to practice and improve skill

Ответить