Rearrange page numbers for printing a book
Style

Your code is not too far from following PEP8 and you know PEP8: it would have been a nice touch for volunteer reviewers to provide a piece of code even closer to what they expect. You'll find various tools (online or not) to check more or less precisely the compliancy of your code to PEP8. For most points, once you get used to it, it doesn't take any longer to apply as as you write the code.

Float ?

The following piece of code

pages = float(input("How many total pages is the book?"))


seems to imply that pages could be a float. As far as I can tell, this value corresponds to a number of page and an int would be more appropriate. Also, to be sure, I've tried giving a 0.5 value and the code is stuck in a loop.

Code organisation

Your code is the perfect example of a piece of code that could have been written as a clear function: input and output are both well-defined. Once you're done, you can even write unit-tests for it. Then, the code calling your function could be behind an if __name__ == "__main__": guard.

You'd get something like:

def page_order(pages):
    num_booklets = pages/32
    if (pages &lt; 32):
        num_booklets = 1
    pages_per_booklet = int(pages/num_booklets)
    last_booklet = int(pages%32)

    f = 1               #first page of the book
    n = int(pages_per_booklet)  #last page of the first booklet
    k = 1               #number of booklets completed
    print_order = []

    while (len(print_order) &lt; pages):
        while ((len(print_order) &lt; pages_per_booklet*k) 
        and (len(print_order) &lt; pages)):
            print_order.extend([n, f, f+1, n-1])
            n -= 2
            f += 2
        k += 1
        n = pages_per_booklet * k
        f = 1 + (pages_per_booklet*(k-1))
        if ((len(print_order)+pages_per_booklet) &gt; pages):
            n = int(pages)
            f = int(pages) - last_booklet
    return (print_order)

tests = {
    0: [],
    1: [1, 1, 2, 0],
    2: [2, 1, 2, 1],
    3: [3, 1, 2, 2],
    4: [4, 1, 2, 3],
    5: [5, 1, 2, 4, 3, 3, 4, 2],
    6: [6, 1, 2, 5, 4, 3, 4, 3],
    7: [7, 1, 2, 6, 5, 3, 4, 4],
    8: [8, 1, 2, 7, 6, 3, 4, 5],
    9: [9, 1, 2, 8, 7, 3, 4, 6, 5, 5, 6, 4],
    10: [10, 1, 2, 9, 8, 3, 4, 7, 6, 5, 6, 5],
    11: [11, 1, 2, 10, 9, 3, 4, 8, 7, 5, 6, 6],
    12: [12, 1, 2, 11, 10, 3, 4, 9, 8, 5, 6, 7],
    13: [13, 1, 2, 12, 11, 3, 4, 10, 9, 5, 6, 8, 7, 7, 8, 6],
    14: [14, 1, 2, 13, 12, 3, 4, 11, 10, 5, 6, 9, 8, 7, 8, 7],
    15: [15, 1, 2, 14, 13, 3, 4, 12, 11, 5, 6, 10, 9, 7, 8, 8],
    16: [16, 1, 2, 15, 14, 3, 4, 13, 12, 5, 6, 11, 10, 7, 8, 9],
    17: [17, 1, 2, 16, 15, 3, 4, 14, 13, 5, 6, 12, 11, 7, 8, 10, 9, 9, 10, 8],
    18: [18, 1, 2, 17, 16, 3, 4, 15, 14, 5, 6, 13, 12, 7, 8, 11, 10, 9, 10, 9],
    19: [19, 1, 2, 18, 17, 3, 4, 16, 15, 5, 6, 14, 13, 7, 8, 12, 11, 9, 10, 10],
}

if __name__ == "__main__":
    if False:  # Interactive
        pages = int(input("How many total pages is the book?" ))
        print(page_order(pages))
    else:  # Automatic tests
        for inpu, expected_val in tests.items():
            res = page_order(inpu)
            if res != expected_val:
                print(inpu, res, expected_val)
        print("DONE")


divmod

When you perform both a division and a modulo operation with the same values, you can use the more concise and faster divmod builtin function.

def page_order(pages):
    num_booklets, last_booklet = divmod(pages, 32)
    if pages &lt; 32:
        num_booklets = 1


Then I do not understand enough what your code is trying to achieve to try to be able to help more. For the time being, the code looks like:

def page_order(pages):
    num_booklets, last_booklet = divmod(pages, 32)
    if pages &lt; 32:
        num_booklets = 1
    pages_per_booklet = pages/num_booklets

    f = 1  #first page of the book
    n = pages_per_booklet  #last page of the first booklet
    k = 1  # number of booklets completed
    print_order = []

    while len(print_order) &lt; pages:
        while len(print_order) &lt; min(pages, pages_per_booklet*k):
            print_order.extend([n, f, f+1, n-1])
            n -= 2
            f += 2
        k += 1
        n = pages_per_booklet * k
        f = 1 + (pages_per_booklet*(k-1))
        if len(print_order) + pages_per_booklet &gt; pages:
            n = pages
            f = pages - last_booklet
    return print_order