← Back to challenges

Burglary Series (14): Adjectives Total

PythonMediumobjectsarrayslanguage_fundamentals

Instructions

You call your spouse in anger and a "little" argument takes place. Count the total amount of insults used. Given a dictionary of insults, return the total amount of insults used.

Examples

total_amount_adjectives({ "a": "moron" }) ➞ 1

total_amount_adjectives({ "a": "idiot", "b": "idiot", "c": "idiot" }) ➞ 3

total_amount_adjectives({ "a": "moron", "b": "scumbag", "c": "moron", d: "dirtbag" }) ➞ 4

Notes

The dictionary will never be empty.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: String to Integer and Vice Versa