pythonize this!

Ulrich Eckhardt eckhardt at satorlaser.com
Tue Jun 15 08:12:12 EDT 2010


superpollo wrote:
> ...     s += i**2
> ...     if not (i+1)%5:
> ...         s -= 2*i**2
> ...     if not i%5:
> ...         s -= 2*i**2

if not (i % 5) in [1, 2]:
    s += i**2
else:
    s -= i**2

Untested code.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list