I got it! One of the testcases was wrong,

    ([[1], [1]],            [1],    [1, 1]),

should be

    ([[1], [1]],            [1],    [1, 1, 1]),


And the working solution.

def supersum(sequence, start=0):
    result = start
    start = type(start)()
    for item in sequence:
        try:
            item = supersum(item, start)
        except TypeError:
            pass
        try:
            result = result + item
        except TypeError:
            return result + sequence
    return result


I couldn't yet get around doing type(start)() and it's pretty messy, but 
anyways...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to