Sentence Starter
Sometimes you need to clean up the beginning of a line without changing the rest of the text. Given a string sentence, make the first character uppercase if it is a lowercase letter, and leave every other character exactly as it is. If the string is empty, return it unchanged.
Примеры
Ввод
"hello world"Вывод
"Hello world"Ввод
"123 hello world"Вывод
"123 hello world"Ввод
" hello world"Вывод
" hello world"Нужно реализовать
def capitalize(sentence: str) -> str:
Теги
strings
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
"hello world"Expected
"Hello world"2
Input
"123 hello world"Expected
"123 hello world"3
Input
" hello world"Expected
" hello world"4
Input
"a"Expected
"A"5
Input
""Expected
""6
Input
" "Expected
" "Focus radio
Paused · SomaFM · Fluid