zjfz-2019-s402281/regexp/Task305.py
2020-01-12 17:48:19 +01:00

12 lines
310 B
Python

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