Is it true loops always give the sorted structure output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it true loops always give the sorted structure output

b = ["y", "b", "n"] for i in b: if len(b) == 3: print(len(b)) output: 3 3 3

29th Sep 2017, 1:59 PM
adito alfatah
adito alfatah - avatar
1 Answer
0
No, but it's easy if you use sorted command on the list and after that using loop will give the sorted list 100% allways
30th Sep 2017, 4:35 PM
Ismail Zam Zam
Ismail Zam Zam - avatar