[Tutor] help with homework

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Oct 29 03:13:27 CET 2012


On 29/10/2012 01:40, Matthew Ngaha wrote:
>>
>> In your original getNames do something like this.
>>> Initialise a counter to zero.
>>> Every time you get a valid name increment the count.
>>> If the count is three you're finished.
>>>
>> hey i was looking at the question as im learning also. With the counter,
> would you use a while loop instead of a for loop, with the condition being
> something like, while count < 3:  ? without len() the for loop option seems
> difficult
>

Always use a while loop in this situation, regardless of whether or not 
teachers put stupid artificial constraints on your code, such as banning 
the use of len().

-- 
Cheers.

Mark Lawrence.



More information about the Tutor mailing list