< Kurs:Python < LG < Py2009

Sortieren

Ich möchte Zahlen sortieren lassen.

Siehe auch: Sortier-Algorithmen

ref1     = 9
ref2     = 7
tauscher = 0

if ref1 > ref2:
    tauscher = ref1
    ref1 = ref2
    ref2 = tauscher
    
print ref1,  ref2

Zählschleifen

Countdown

for i in range(10, -1, -1): 
    print i
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.