task c10 no idea

This commit is contained in:
luminoksik 2025-01-09 10:54:18 +01:00
parent c726906fcd
commit bb99e42844

28
TaskC10/task10.py Normal file
View File

@ -0,0 +1,28 @@
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>'
# def convert(given_text):
# given_text = int(given_text, 16)
# return given_text
### 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))