The middle part of each code is the model year. Extract it with str.extract(r"-(\d{4})-") and store the years as integers in result.
import pandas as pd
items = pd.DataFrame({"code": ["LAP-2023-PUNE", "PHN-2024-DELHI", "TAB-2022-MUMBAI", "LAP-2024-PUNE"]})Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.