def total_count(counts): total = 0 for count in counts: if type(count) is not int or count < 0: raise ValueError("Counts must be nonnegative integers") total += count return total print(total_count([7, 4, 0, 6])) print(total_count([]))