new = 0
binary=input ("Enter binary:")
length = len(binary)
for x in range (0,3):
    if length<9 and all (c in "01" for c in binary):
        for digits in binary:
            new = new*2 + int(digits)
        print ("The binary numbers {0} converted into decimal is {1}".format(binary,new))
        break
    else:
        binary=input ("Try again. Enter binary (max. 8):")
print ("The programme will end")
The code works well and outputs the decimal format for the initial 3 inputs but for the last, when the input is correct it still outputs "The program will end" and not the decimals.
EDIT: Thanks for all the help, I've fixed the problem
