def sum_of_integers_in_string(s):
sum = 0
for x in s:
if x.isdigit() == True: #check if its a digit
if isinstance(x, int) == True: #check if its int and sum
sum += int(x)
if isinstance(x, float) == True: #check if its float and sum
sum += float(x)
else:
sum = 0
return sum
I'm trying to solve this kata, however, it do not passes any test from these:
exampleTests = (
("12.4", 16),
("h3ll0w0rld", 3),
("2 + 3 = ", 5),
("Our company made approximately 1 million in gross revenue last quarter.", 1),
("The Great Depression lasted from 1929 to 1939.", 3868),
("Dogs are our best friends.", 0),
("C4t5 are 4m4z1ng.", 18),
("The30quick20brown10f0x1203jumps914ov3r1349the102l4zy dog", 3635)
)
I think there is any issue in the part of summing an int or float. Any help?