Guessing Passcode in Python

Same thing as yesterday, written in Python.

from __future__ import print_function, division


def zpad(num, length):
    return str(num).zfill(length)


def possibilities(length):
    return [zpad(n, length) for n in range(int('9' * length))]


def main():
    the_code = raw_input("Please give me the code to guess (integer only): ")

    code_digits = len(the_code)
    code_matched = ''

    print("The code is {} digits long.".format(code_digits))
    print('Begin guessing ...')

    # check basics
    guessed = []
    for n in range(10):
        guess = str(n) * code_digits
        guessed.append(guess)

        if guess == the_code:
            code_matched = guess
            break

    # now brute force
    if len(code_matched) == 0:

        # create array of all possibilities
        possibles = [n for n in possibilities(code_digits) if n not in guessed]

        for guess in possibles:
            if guess == the_code:
                code_matched = guess
                break

    if len(code_matched) > 0:
        print("The code is {}. Right?".format(code_matched))
    else:
        print("I can't find your code. Are you cheating?")


if __name__ == "__main__":
    main()

I’ve been bored lately.