tasks 3
This commit is contained in:
parent
3c548406d5
commit
60511011c5
|
@ -0,0 +1,10 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
"""Rozwiązanie zadania 301."""
|
||||||
|
|
||||||
|
def letter_and_two_digits(reular):
|
||||||
|
|
||||||
|
return re.match(".*[A-Z][0-9][0-9].*$", reular)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(letter_and_two_digits("G213923d"))
|
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
"""Rozwiązanie zadania 302."""
|
||||||
|
|
||||||
|
def extract_minutes(string):
|
||||||
|
|
||||||
|
if re.match("([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", string):
|
||||||
|
return string[-2:]
|
||||||
|
else:
|
||||||
|
return '<NONE>'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(extract_minutes("25:14"))
|
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
"""Rozwiązanie zadania 303."""
|
||||||
|
|
||||||
|
def divisable_by_four(divisableNumber):
|
||||||
|
|
||||||
|
if re.match("(?:\d*[02468][048]|\d*[13579][26]|[048])(?!\d)", divisableNumber):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(divisable_by_four("45002"))
|
|
@ -0,0 +1,10 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
"""Rozwiązanie zadania 310."""
|
||||||
|
|
||||||
|
def is_football_result(reular):
|
||||||
|
|
||||||
|
return re.match("(10|[0-9]):(10|[0-9])$", reular)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(is_football_result("10:10"))
|
Loading…
Reference in New Issue