13 lines
287 B
Python
13 lines
287 B
Python
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()) |