Repeat the Ending
Sometimes you need to take the end of a string and use it as a short repeating pattern. Write a function extra_end that takes a string s with length at least 2. Take the last two characters and return them repeated three times in a row.
Примеры
Ввод
"Hello"Вывод
"lololo"Ввод
"ab"Вывод
"ababab"Ввод
"Hi"Вывод
"HiHiHi"Нужно реализовать
def extra_end(s: str) -> str:
Теги
strings
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
"Hello"Expected
"lololo"2
Input
"ab"Expected
"ababab"3
Input
"Hi"Expected
"HiHiHi"4
Input
"Candy"Expected
"dydydy"5
Input
"CandyCandy"Expected
"dydydy"6
Input
"abc"Expected
"bcbcbc"Focus radio
Paused · SomaFM · Fluid