• + 0 comments

    in python I use 2 loop

    def pageCount(n, p):
        nbFlipFront = 0
        pageFront = 1
        pageBack = n
        nbFlipBack = 0
        while pageFront != p+1:
            print(f"actual page from front:{pageFront}")
            if pageFront%2 == 0:
                nbFlipFront += 1
            pageFront+=1
        
        while pageBack != p :
            print(f"actual page from back:{pageBack}")
            if pageBack%2 == 0:
                nbFlipBack +=1
            pageBack -=1