Nic wrote:

> In my example I've chosen the number 3.
> How should I change the Python code in order to select another number
> (e.g. 7)?

Here is a parameterized render().

def render(w, h, suffixes="ab"):
    pairs = list(unique(range(1, h+1), 2))
    for item in unique(pairs, w):
        for suffix in repeat(*[suffixes]*w):
            yield tuple((a, b, s) for (a, b), s in izip(item, suffix))

if __name__ == "__main__":
    for item in render(3, 4, "abc"):
        print " ".join("%s%s%s" % t for t in item)

Experiment with the numbers to see the effects

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to