ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
Re: [Tutor] Creatively solving math problems -----help
by Clay Shirky other posts by this author
Sep 11 2003 1:52PM messages near this date
[Tutor] Creatively solving math problems -----help | [Tutor] Re: [pygame] Fastest (x,y) distance calculation
>  for x in range(20000):
>        if [x%y for y in range(2, 7)] == 1 and x % 7 == 0:
>                print x

This is awfully hard to read -- any reason you're trying to cram so much
stuff on one line? Is this what you are trying to do?

for x in range(20000):
    for y in range(2, 7):
        if x % y == 1 and x % 7 == 0:
            print x
            break

If so, it will be easy to start altering from there.

-clay


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Conrad Koziol
Clay Shirky

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved