First Half
Slices help you split a string neatly into parts, such as when processing a code or message. Write a function first_half that takes a string s with an even length. Return only the first half of the string, leaving out the second half.
Примеры
Ввод
"WooHoo"Вывод
"Woo"Ввод
"HelloThere"Вывод
"Hello"Ввод
"abcdef"Вывод
"abc"Нужно реализовать
def first_half(s: str) -> str:
Теги
strings
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
"WooHoo"Expected
"Woo"2
Input
"HelloThere"Expected
"Hello"3
Input
"abcdef"Expected
"abc"4
Input
""Expected
""5
Input
"a"Expected
""6
Input
"Hello, World!"Expected
"Hello,"Focus radio
Paused · SomaFM · Fluid