파이썬은 운동 (27)
제목 : 재귀 함수 호출, 다섯 문자를 역순으로 인쇄, 입력됩니다.
프로그램 분석 : 없음.
소스 코드 :
#!/usr/bin/python # -*- coding: UTF-8 -*- def output(s,l): if l==0: return print (s[l-1]) output(s,l-1) s = raw_input('Input a string:') l = len(s) output(s,l)
위 예제의 출력은 다음과 같습니다
Input a string:abcde e d c b a