Latest web development tutorials

Python umfasst 27 Übungen

Python 100 Li Python 100 Li

Titel: rekursive Funktionsaufruf werden fünf Zeichen eingegeben haben , in umgekehrter Reihenfolge ausgedruckt.

Programmanalyse: Keine.

Source Code:

#!/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)

Das obige Beispiel Ausgabe lautet:

Input a string:abcde
e
d
c
b
a

Python 100 Li Python 100 Li