Count Comprehensions

Count Comprehensions

You have to write a function that receives a Python source code, counts list/set/dict/generator comprehensions and returns these counts.
List comprehensions, set comprehensions, dict comprehensions, generator expressions are respectively represented by "ListComp", "SetComp", "DictComp", "GeneratorExp" in the result dictionary.

Input: A string.
Output: A dict with strings as keys and integers as values.


Examples:

count_comprehensions('[n ** 2 for n in range(5)]')...
You should be an authorized user in order to see the full description and start solving this mission.
49