On Fri, 24 May 2013 23:05:17 -0700, lokeshkoppaka wrote:

> On Saturday, May 25, 2013 11:27:38 AM UTC+5:30, Steven D'Aprano wrote:

>> tally = 0
>> for item in list_of_items:
>>     if item == 0:
>>         tally = tally + 1
>> 
>> print "The number of zeroes equals", tally
> 
>
> ya steven i had done the similar logic but thats not satisfying my
> professor he had given the following constrains
>  1. No in-built functions should be used 

The above does not use any built-in functions.

> 2. we are expecting a O(n) solution

The above is O(n).

>  3. Don't use count method

The above does not use the count method.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to