[Tutor] help with homework
pasokan at talentsprint.com
Mon Oct 29 09:37:59 CET 2012
> Always use a while loop in this situation,
This is excellent advice. Use a for loop in two
1. Iterating a fixed(known) number of times
2. Iterating through the contents of any container
Use a while loop to iterate as long as a condition applies.
> regardless of whether or not
> teachers put stupid artificial constraints on your code,
> such as banning the use of len().
There may be legitimate learning outcomes for a teacher
to specify such conditions.
In this case, learning to use a counter that is incremented
under certain conditions. I would hesitate to condemn in
such strong terms without knowing more background.
More information about the Tutor