Code not working for some cases. Please point out the mistake


#1
class Solution:
    # @param A : integer
    # @return a strings
    def convertToTitle(self, A):
        s=''
        A_num=ord('A')
        while A>0:
            s=chr((A-1)%26+A_num)+s
            A=A//26
        return s

#2

replace A = A//26 by A = (A-1)//26


#3

Thank you,

But i’m unabel to relate the logic for -1

can you clarify