I have the following code:
def sum_digits(s):
r = ''.join(x for x in s if x.isdigit())
newList = list(r)
try:
result = sum(int(i) for i in newList)
except:
raise ValueError
return result
print(sum_digits("a;d"))
They should find the numbers in a string , and if they are not found, I should return a ValueError , but it's not coming back, in fact > it returns me 0.
I hope someone can help me. Thank you very much