Middle Pair
Slices help you take not only the start or end of a string, but also a clean piece from the middle. Write a function middle_two that takes a string s with an even length of at least 2. Return the two characters that sit exactly in the middle of the string.
Примеры
Ввод
"string"Вывод
"ri"Ввод
"code"Вывод
"od"Ввод
"Practice"Вывод
"ct"Нужно реализовать
def middle_two(s: str) -> str:
Теги
strings
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
"string"Expected
"ri"2
Input
"code"Expected
"od"3
Input
"Practice"Expected
"ct"4
Input
"ab"Expected
"ab"5
Input
"abc"Expected
"ab"6
Input
"CODE"Expected
"OD"Focus radio
Paused · SomaFM · Fluid