12 lines
310 B
Python
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 |