die Ergebnisse der Schleife sollen nicht einzeln, sonder wieder in einer Liste stehen:
wäre sehr dankbar für einen kurzen Tipp.
Code: Alles auswählen
alle = [20,33,21,32,27,7,25,16,32,27,21,22]
for i in (alle):
if i >0 and i<4:
i = 1
print(i)
if i >3 and i<7:
i = 2
print(i)
if i >6 and i<10:
i = 3
print(i)
if i >9 and i<13:
i = 4
print(i)
if i >12 and i<16:
i = 5
print(i)
if i >15 and i<19:
i = 6
print(i)
if i >18 and i<22:
i = 7
print(i)
if i >21 and i<25:
i = 8
print(i)
if i >24 and i<28:
i = 9
print(i)
if i >27 and i<31:
i = 10
print(i)
if i >30 and i<34:
i = 11
print(i)
elif i>33:
i = 12
print(i)
print (alle)
>>>
7
11
7
11
9
3
9
6
11
9
7
8
>>>
sondern statt alle = [20,33,21,32,27,7,25,16,32,27,21,22] sollte stehen alle = [7,11,7,11,9,3,9,6,11,9,7,8]