jfz-2023-s473564/TaskE04/run.py

13 lines
287 B
Python
Raw Normal View History

2024-01-02 16:07:53 +01:00
import re
def analyze_line(line):
phone_pattern = re.compile(r'^555-\d{3}-\d{3}$|^555\s\d{3}\s\d{3}$')
if phone_pattern.match(line):
print('yes')
else:
print('no')
with open('test.in', 'r') as file:
for line in file:
analyze_line(line.rstrip())