• + 2 comments

    Can you please detect error in my approach?

    q = int(input())
    for i in range(q):
        n = int(input())
        l = len(bin(n)) - 2 #length of bin num
        s = ''
        for i in range(l-1):
            s += '1'
        k = int(s,2)+1 #Get power of 2 less than n
        if n!=k: #If n and k are n not equal, then it means Richard uses first step to make value to power of two.
            l += 1 #In a l length number, the game is performed by l+1 times now because n!=k. So increment l
        if l%2 == 0:          #If l is even, Richard wins.
            print('Richard')
        else:               #Else Louise wins.
            print('Louise')