######################Problem 2########################### def filter_sum(s): """prec: s is a string postc: the total of all digits in the string is returned.""" out = 0 for ch in s: if ch.isdigit(): out += int(ch) return out def filter_sum(s): """prec: s is a string postc: the total of all digits in the string is returned.""" out = 0 for ch in s: if ch in "0123456789": out += int(ch) return out def filter_sum(s): return sum([int(k) for k in s if k.isdigit()]) def main(): print("*************** Problem 2 Tests **************") print(filter_sum("c1o2w3s4moo") == 10) main()