You are viewing a single comment's thread. Return to all comments →
Not the most efficient, but is readable and works
def counterGame(n): powers2 = [] x = 2 while x<=n: powers2.append(x) x *= 2 louise = True while True: if n == 1: break n = n / 2 if n == powers2[-1] else n - powers2[-1] powers2 = [x for x in powers2 if x <= n] louise = not louise return "Richard" if louise else "Louise"
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
Not the most efficient, but is readable and works