add Task 305

This commit is contained in:
Grzegorz Rogozik 2020-01-12 17:48:19 +01:00
parent ca82bf0d9c
commit abb8a01981

12
regexp/Task305.py Normal file
View File

@ -0,0 +1,12 @@
import re
def divisable_by_two(string):
if string.isdigit() == True :
last = string[-1]
if string.startswith('-') | (len(string)>1 and string.startswith('0')):
return False
else:
return bool(re.match(r"2|4|6|8|0", last))
else:
return False