Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
def loop():
i = 0
numbers = []
while i < 10:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is: %d" % i
print "The numbers: "
for num in numbers:
print num
loop()
def loop(zahl):
i = 0
numbers = []
while i < zahl:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is: %d" % i
print "The numbers: "
for num in numbers:
print num
zahl = raw_input("> ")
loop(zahl)
wiederholt sich die Schleife endlos.
Woran liegts?
Besser erklärt, die variable zahl ist nicht definiert!
Viele Grüße Micky2010
Zuletzt geändert von Micky2010 am Dienstag 9. August 2011, 14:06, insgesamt 1-mal geändert.
Errare humanum est, in errore perseverare stultum (Irren ist menschlich, im Irrtum verbleiben ist dumm) Manus manum lavat (Eine Hand wäscht die andere)