Our teacher has told us to make a program that validates a postcode as a Northern Ireland postcode. That means it must have the letters "BT" in it and must equal 8 characters. In the code below I managed to get the letters part working. However, he did not go into detail on how to make the input equal 8 characters. He mentioned using .length() and validation(try and except), but I'm unsure how to use .length() to get 8 characters. Here's my code:
postcode = input("Please enter an Northern Ireland postcode:")
BT = "BT"
while BT not in postcode:
postcode = input("That isn't a Northern Ireland postcode. Try again:")
print("This is a Northern Ireland postcode")