:
for i in range(len(a)):
lister.append(int(a[i]))
return sum(lister) % 10 == 0 or sum(lister) == 0
return True, True False, True
a comp:
lister = [int(i) for i in a ]
return sum(lister) % 10 == 0 or sum(lister) == 0
:
lister_sum = sum(int(i) for i in a )
return lister_sum % 10 == 0 or lister_sum == 0
, all str.isdigit, try/except:
if len(S) != 19 or not all(x.isdigit() for x in a)
, :
def check(s):
spl = s.split()
if len(spl) != 4 or not all(len(x) == 4 for x in spl):
return False
a = s.replace(" ","")
elif len(s) != 19 or not all(x.isdigit() for x in a):
return False
lister_sum = sum(int(i) for i in a)
return lister_sum % 10 == 0
try/except, map:
def check(s):
if len(s) != 19:
return False
spl = s.split()
if len(spl) != 4 or not all(len(x) == 4 for x in spl):
return False
a = s.replace(" ","")
try:
a = list(map(int,a))
except ValueError:
return False
return sum(a) % 10 == 0