> for x in range(10): > for y in range(10): > if 2^x*3^y==12: > break > > (x,y) >
I think the most "pythonic" solution would be to use itertools.product, which requires python 2.6 or greater (and hence sage 4.1 or greater): sage: import itertools sage: for x,y in itertools.product(range(10), range(10)): ...: if 2^x*3^y == 12: ...: break ...: sage: print x,y 2 1 -cc --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---