John Salerno wrote: > 2. just make it a function that takes a second argument, that being the > number of times you want it to repeat itself and create numbers in the > sequence
Here's what I've come up with so far. Probably not the most elegant solution because of the nested function, but it does work! :) def morris(seed, limit): num = seed numberSet = [] def nextNum(num): num = list(str(num)) grouping = [] nextNum = [] for i in range(len(num)): try: if num[i] == num[i + 1]: grouping.append(num[i]) else: grouping.append(num[i]) nextNum.append(str(len(grouping)) + num[i]) grouping = [] except IndexError: grouping.append(num[i]) nextNum.append(str(len(grouping)) + num[i]) return ''.join(nextNum) for x in range(limit): numberSet.append(int(num)) num = nextNum(num) return numberSet -- http://mail.python.org/mailman/listinfo/python-list