UK Car Plate Number Decoder

Did you know you can find out where a UK car was first registered or how old it is just by looking at its number plate?

In this Python challenge, we will create a program that decodes a UK plate number. The program will ask the user to enter a UK car registration plate and the program will then:

  • Identify the regional registration area of the car
  • Calculate the approximate age of the vehicle

Decoding a UK Plate Number

Modern UK registration plates follow this format:

Regional Area Codes

The first letter of the area code tells us where the vehicle was registered sing the following letters/codes

Letter Region
A Anglia
B Birmingham
C Cymru (Wales)
D Deeside / Shrewsbury
E Essex
F Forest and Fens
G Garden of England
H Hampshire and Dorset
K Luton / Northampton
L London
M Manchester and Merseyside
N North
O Oxford
P Preston / Carlisle
R Reading
S Scotland
V Severn Valley
W West of England
Y Yorkshire

Age Identifier Rules

The two numbers in the registration plate indicate when the vehicle was first registered. It covers a 6-month period, which is why new plates are issued twice a year and the age identifier is determined based on the following rules:

  • For vehicles registered between March and August hold, we use the last 2 digits of the year it was put on the road. e.g for a car registered in March 2026, the age identifier code used is 26.
  • For cars registered from September to February, we use the same approach but add 50 to the code. So for a car registered in September 2026, the age identifier will be 26 + 50 = 76

So to determine the approximate age of a car based on the age identifier we will use the following rule:

Age of a Car?

Once we have established the year of registration of a car, we can estimate its age (in years) using the following formula:

What about the last 3 letters?

Unlike the first 4 characters of a plate which have a meaning, the final 3 letters don’t mean anything. Instead, these random 3-letter combinations are used to help keep each plate number unique compared to other plate numbers for cars registered at the same time.

Python Challenge

Let’s write a Python program that will:

    Ask the user to enter a valid UK registration plate number
    Validate this number ensuring that the plate number is exactly 8 characters long (including the space before the last 3 letters)
    Extract the first digit of the plate number (first digit of the area code)
    Extract the 2 number digits (age Identifier: the 3rd and 4th digits of the plate number)
    Lookup the area code within the list of area codes and output the area where the vehicle was registered.
    Calculate and output the estimated registration year of the vehicle.
    Calculate and output the estimated age (in years) of the vehicle.

We have started the code for you but this code is incomplete. Can you complete the code to calculate both the registration year and the estimated age of the car.

Testing:

Use you code to work out the area code and estimated age of the following vehicles:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!