Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What about :

sum([u[0]*u[1] for u in f if all([(v%5)==0 for v in u[1].exponents()[0]])])

This kind of brutal one-liner isn't very readable. If you plan to use this kind of trick often, generalizing it in a cleanly written and documented function is probably a better way...