task c42 done, c2 fixed

This commit is contained in:
luminoksik 2025-01-09 11:07:44 +01:00
parent bb99e42844
commit cea1d6bd49
2 changed files with 30 additions and 3 deletions

View File

@ -17,7 +17,9 @@ def check(given_text):
# line = line.strip()
# print(check(line))
flag = True
while flag is True:
while True:
text = input('Please provide your text: ')
print(check(text))
if text == 'END':
break
print(check(text))
print('To end type END')

25
TaskC42/task42.py Normal file
View File

@ -0,0 +1,25 @@
import re
pattern = re.compile(r'^N((I[E]{6,})|([O]{6,}))[!]{3,}$')
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')