import re def big_letter(file_path): pattern = r'.*[A-Z]\d{2}.*' with open(file_path, 'r', encoding='utf-8') as file: for line in file: if re.match(pattern, line.strip()): print('yes') else: print('no') file_path = 'TaskE09/test.in' big_letter(file_path)