forked from miczar1/djfz-24_25
task C2 done
This commit is contained in:
parent
d7a9ac3994
commit
c726906fcd
23
TaskC02/task2.py
Normal file
23
TaskC02/task2.py
Normal file
@ -0,0 +1,23 @@
|
||||
import re
|
||||
|
||||
pattern = re.compile(r'^\d{2}-\d{3}$')
|
||||
|
||||
def check(given_text):
|
||||
result = re.search(pattern, given_text)
|
||||
if result:
|
||||
return given_text[:2]
|
||||
else:
|
||||
return '<NONE>'
|
||||
|
||||
### test
|
||||
|
||||
# with open('test.in', 'r', encoding='utf-8') as f:
|
||||
# lines = f.readlines()
|
||||
# for line in lines:
|
||||
# line = line.strip()
|
||||
# print(check(line))
|
||||
|
||||
flag = True
|
||||
while flag is True:
|
||||
text = input('Please provide your text: ')
|
||||
print(check(text))
|
Loading…
Reference in New Issue
Block a user