[Tutor] Creatively solving math problems -----help

Clay Shirky clay at shirky.com
Thu Sep 11 16:23:24 EDT 2003


> for x in range(20000):
>    if x % 7 == 0:

And reading this, it occurs to me that you could do this with a range stride
of 7 as well:

for x in range(0, 200, 7): # <--- count by 7s
    for y in range(2, 7):
        if x%y == 1:
            print x
            break

-clay




More information about the Tutor mailing list