Eventually, I would like to generalize this solutions to work with a Tuple of any length. I think recursion is required for that, but I haven't been able to do it.def combineRanges(maxValues) :    for x in range(0, maxValues[0]) :        for y in range(0, maxValues[1]) :            for z in range(0, maxValues[2]) :                print (str(x) + '-' + str(y) + '-' + str(z));m = (6,9,20);    combineRanges(m);http://repl.it/WiZ
Is this looping solution possible with recursion?
recursion;python 3.x
There is no need for recursion here; you can use itertools.product, map and tuple unpacking:from itertools import productdef combine_ranges(max_values):    for t in product(*map(range, max_values)):        print(-.join(map(str, t)))A shorter example:>>> combine_ranges((2, 2, 2, 2))0-0-0-00-0-0-10-0-1-00-0-1-10-1-0-00-1-0-10-1-1-00-1-1-11-0-0-01-0-0-11-0-1-01-0-1-11-1-0-01-1-0-11-1-1-01-1-1-1Note use of PEP-8-compliant names.