[Tutor] Issue w/ while loops
Here's an example where naming the while loop might be helpful in making the code easier to understand. Or not. : P Let's see what this might look like.
Here's an example where naming the while loop might be helpful in making the code easier to understand. Or not. : P Let's see what this might look like.
Such code would never pass code review among even moderately experienced Python coders, let alone experts. By teaching this first, Stefan's students have to literally unlearn what he teaches them, in order to learn the right way of walking a string
A basic do-while loop would look like this(That is, <setup code> is still repeated each time around the loop - it's called that because it is run before the loop evaluated condition is evaluated).
The 'do' will execute at least once, so > the else clause is not needed, nor is the <loop completion code>. The <loop > body> should go before the while terminator. This objection is based on a misunderstanding of what the else clause is for in a Python loop.