[PyAR2] Programming Challenge II - One is the Magic Number

Chris Calloway cbc at unc.edu
Tue Oct 28 15:37:22 CET 2008


On 10/28/2008 1:09 AM, Jesse Jaggars wrote:
> sum(int(str(x).count("1")) for x in xrange(1000000))

You don't need the int(). count() returns an int.

-- 
Sincerely,

Chris Calloway
http://www.secoora.org
office: 332 Chapman Hall   phone: (919) 599-3530
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599





More information about the PyAR2 mailing list