i have a problem with my code, tried looking up how to fix it and tried multiple methods but its just not going
Here is what i got:
with open("people-data.txt") as f:
children= {}
for line in f.readlines():
parent, child = line.split("->")
children[parent] = child
I tried using: children[parent].append(child)
and other things.
My file looks like this:
Mary->Patricia
Mary->Lisa
Patricia->Barbara
What I would like is when I use children[Mary]
I get ['Patricia', 'Lisa']
but what my code does is give my just 'Lisa'
and overrides 'Patricia'
.