diff --git a/TaskC10/task10.py b/TaskC10/task10.py index f18581e..6e48f2a 100644 --- a/TaskC10/task10.py +++ b/TaskC10/task10.py @@ -1,28 +1,27 @@ import re -pattern = re.compile(r'^\d{2}-\d{3}$') +pattern = re.compile(r'^[1248]0*$') def check(given_text): result = re.search(pattern, given_text) if result: - return given_text[:2] + return 'yes' else: - return '' + return 'no' -# 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)) +# 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)) \ No newline at end of file +while True: + text = input('Please provide your text: ') + if text == 'END': + break + print(check(text)) + print('To end type END') \ No newline at end of file