| 1 | initial version |
More straightforward
sage: sum = 15
sage: xmin = 1
sage: xmax = 9
sage: ymin = 1
sage: ymax = 9
sage: for x in range(max(xmin, sum-ymax), min(xmax, sum-ymin)+1):
....: print(x, sum-x)
6 9
7 8
8 7
9 6
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.