확실히,그것은 매우 간단한 프로그램입니다. 당신이해야 한 문자열을 소개한 방법과 문자열 색인에서는 파이썬 명확한 아이디어를 얻을. 게 설명에서 이 deatial.
인쇄(reverse_string('안녕하세요'))//인쇄 기능을 부르는 또 다른 기능
reverse_string 과 전달을 인수"안녕하세요".
def reverse_string(string)://argument"hello"라는 변수에 저장됩
문자열에 reverse_string 기능입니다.
**new_strings = []** // created a new empty list
**index = len(string)** // len function returns the length of the argument
passed to the function. len("hello")=5 and assigned
to index. index=5.
동 index: //는 동안 반복 exicute 상태까지 얻을 거짓입니다.이
예 때 index=0.에서 문자열을 색인 0 에서 시작.대
예입니다.
string[0]=h,string[1]=e,string[2]=l,string[3]=l,string[4]=o.
**index -= 1** //Note the last letter 'o' is in string[4] and the len
function returned 5 so we need to decrement index variable
to 4 so that it will pointing to string[4]=o
new_strings.append(string[index]) //append string[4]는 o 다.
return".가입(new_strings)