Rotate Right
Here the string rotates in the other direction: the ending becomes the beginning. Write a function right2 that takes a string s with length at least 2. Take the last two characters, place them at the start, and return the resulting string.
Примеры
Ввод
"Hello"Вывод
"loHel"Ввод
"java"Вывод
"vaja"Ввод
"Hi"Вывод
"Hi"Нужно реализовать
def right2(s: str) -> str:
Теги
strings
Jelentkezz be a beküldési előzmények megtekintéséhez
BejelentkezésJelentkezz be az MI-mentor használatához
BejelentkezésVisible tests
1
Input
"Hello"Expected
"loHel"2
Input
"java"Expected
"vaja"3
Input
"Hi"Expected
"Hi"4
Input
"abcd"Expected
"cdab"5
Input
""Expected
""6
Input
"JAVA"Expected
"VAJA"Focus radio
Paused · SomaFM · Fluid