add Task 305
This commit is contained in:
parent
ca82bf0d9c
commit
abb8a01981
12
regexp/Task305.py
Normal file
12
regexp/Task305.py
Normal 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
|
Loading…
Reference in New Issue
Block a user