Because this mission does not accept solutions, or allow you to publish them, I thought I would post my solution and see what you think.
def flatten(dictionary):
stack = [((), dictionary)]
result = {}
while stack:
path, current = stack.pop()
#print(current)
#print(current.items())
for k, v in current.items():
if isinstance(v, dict):
if v == {}:
v = ""
stack.append((path, {k : v}))
continue
stack.append((path + (k,), v))
else:
#print(path, k, v)
result["/".join((path + (k,)))] = v
#print(result)
return result
Thanks!
Created at: Sept. 29, 2016, 8:01 p.m.; Updated at: Sept. 30, 2016, 7:34 p.m.