Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python: takes a dictionary and returns the sum of all of the summable values in it

def sum_summables(dictionary):
    total = 0
    for v in dictionary.values():
        if (isinstance(v, int) or isinstance(v, float)):
            total += v
        elif v.isnumeric():
            total += float(v)
    return total
 
PREVIOUS NEXT
Tagged: #takes #dictionary #returns #sum #summable #values
ADD COMMENT
Topic
Name
9+1 =