e od 0 do 7

This commit is contained in:
Pawel Felcyn 2024-01-07 23:04:53 +01:00
parent 9e915b26ba
commit b1e6a2a7f8
8 changed files with 109 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^[1-9]*(0|5)$'
pattern = r'^(5|0|[1-9][0-9]*[05])$'
if re.match(pattern, input_string):
print('yes')

18
TaskE01/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^(0|25|50|75|[1-9][0-9]*(25|00|50|75))$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass

0
TaskE02/run.py Normal file
View File

18
TaskE03/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^(\d{3}-\d{3}-\d{2}-\d{2}|\d{3}\d{2}-\d{2}-\d{3})$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass

18
TaskE04/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^555(-\d{3}-\d{3}| \d{3} \d{3})$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass

18
TaskE05/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^(PCMCIA|WYSIWYG|[A-Z]{2,5})$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass

18
TaskE06/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^[1-9]\d{4,5}$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass

18
TaskE07/run.py Normal file
View File

@ -0,0 +1,18 @@
import re
def check_number_divisible_by_5(input_string):
pattern = r'^\*+$'
if re.match(pattern, input_string):
print('yes')
else:
print('no')
if __name__ == "__main__":
try:
while True:
line = input()
check_number_divisible_by_5(line)
except EOFError:
pass