Reverse a string · 문자열 뒤집기
Reverse a string
Return the string with its characters back-to-front: reverse_string("abc") gives "cba".
Python slicing has a neat trick: s[::-1] walks the string with a step of -1, from the end to the start. You can also build the answer with a loop if you prefer.
문자열 뒤집기
문자를 거꾸로排列한 문자열을 반환합니다: reverse_string("abc")은 "cba"을 줍니다.
Python 슬라이싱에는 재치 있는 트릭이 있습니다: s[::-1]은 -1의 간격으로 끝에서 시작해 문자열을 순회합니다. 원하신다면 루프로 결과를 만들기도 합니다.
Write reverse_string(s) that returns s with its characters in reverse order. A slice s[::-1] does it in one step. · reverse_string(s)를 작성하여 s의 문자를 역순으로 한 결과를 반환하십시오.slice s[::-1]로 한 단계에 해결할 수 있습니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.