jezyki-formalne/TaskC10/task10.py

27 lines
505 B
Python

import re
pattern = re.compile(r'^[1248]0*$')
def check(given_text):
result = re.search(pattern, given_text)
if result:
return 'yes'
else:
return 'no'
### test
# with open('test.in', 'r', encoding='utf-8') as f:
# lines = f.readlines()
# for line in lines:
# line = line.strip()
# print(check(line))
while True:
text = input('Please provide your text: ')
if text == 'END':
break
print(check(text))
print('To end type END')