Python-Übungsbeispiel 32

Python 100例Python 100 Beispiele

Titel:Geben Sie die Werte der Liste in umgekehrter Reihenfolge aus.

Programmanalyse:Keine.

Programmquellcode:

Beispiel

#!/usr/bin/python # -*- coding: UTF-8 -*- a = ['one', 'two', 'three'] for i in a[::-1]: print (i)

Die Ausgabe des obigen Beispiels ist:

three
two
one

Python 100例Python 100 Beispiele

Weitere Erweiterungen