Why is "while" loop really needed in Python?

Posted by Tomaž Pisanski on Stack Overflow See other posts from Stack Overflow or by Tomaž Pisanski
Published on 2010-03-14T06:53:12Z Indexed on 2010/03/14 6:55 UTC
Read the original article Hit count: 285

Filed under:
|
|

I was told that 95% of all loops in Python are "for" loops. Since "while" loops are clearly more "dangerous" than "for" loops, I would like to know if there are situations in which the use of a "while" loop is essential. For teaching purposes it would be useful to know if there is a systematic way of transforming "while" loops into "for" loops.

© Stack Overflow or respective owner

Related posts about python

Related posts about teaching