• Працює в PyCharm але чому тут не працює?

Question related to mission The Flat Dictionary

 

n = '' resul = {}

def flatten(dictionary): global n, resul for key, value in dictionary.items(): if len(value) < 1: resul[n + key] = '' if type(value) == type(dict()): n += key + '/' flatten(value) else: resul[n + key] = value n = '' return resul