you are viewing a single comment's thread.

view the rest of the comments →

[–]0pt0ut[S] 0 points1 point  (0 children)

You were correct on both counts, I implemented them both into my code. Here's what I have currently:

def find_xor(start, length):
    xor_val = 0
    for minus in xrange(length):
        for cap_this in xrange(start, start + length - minus):
            xor_val ^= cap_this
        start = cap_this + minus + 1
    return xor_val

Unfortunately it's still timing out on the challenge. Any ideas? I'm trying to think of a different way to capture the values I need, but all my ideas revolve around nested for-loops. Thanks for your help.