Μπορεί να μετατραπεί η ακόλουθη while σε for;
i=18
while i>8:
print i
i=i-2
for i in range(18, 9, -2):
for i in range(18, 10, -2):
for i in range(16, 8, -2):
i=0
while i<50:
i=i+1
for i in range(1,51):
for i in range(50):
η while σε for; Are you sure?
i=10
while i>2:
i=i-3
for i in range(2, 10, -3):
for i in range(10, 0, -3):
for i in range(10, 2, -3):
i=30
while i>19:
for i in range(19, 30, -2):
for i in range(30, 17, -2):
for i in range(30, 19, -2):
while i < 25:
i=i+5
for i in range(10, 26, 5):
for i in range(10, 25, 5):
for i in range(25, 10, 5):
for i in range(15, 25, 5):
for i in range(10, 21, 5):
Μπορεί να μετατραπεί η παρακάτω while σε ισοδύναμη for;
i=4
while i>0:
i=i-1
for i in range(3,-1,-1):
for i in range(4,0,-1):
Με τίποτα!
while i>15:
χμμ... μάταιος κόπος, i=4
for i in range(4,15):
for i in range(15,4,-1):