Neat Word Case
This is useful when text needs to look clean, such as a name, title, or label. Write a function capitalize_words that takes a string s where words are separated by spaces. Make the first letter of each word uppercase and the remaining letters lowercase.
Примеры
Ввод
"hello world"Вывод
"Hello World"Ввод
"PYTHON code"Вывод
"Python Code"Ввод
"a"Вывод
"A"Нужно реализовать
def capitalize_words(s: str) -> str:
Теги
strings
Συνδεθείτε για να δείτε το ιστορικό υποβολών
ΣύνδεσηΣυνδεθείτε για να χρησιμοποιήσετε τον AI Mentor
ΣύνδεσηVisible tests
1
Input
"hello world"Expected
"Hello World"2
Input
"PYTHON code"Expected
"Python Code"3
Input
"a"Expected
"A"4
Input
""Expected
""5
Input
"one two three"Expected
"One Two Three"6
Input
" "Expected
" "Focus radio
Paused · SomaFM · Fluid