Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pythong Dictionaries

Name: Anonymous 2011-03-16 18:21

I can't figure out how to do this, I tried recursion but I'm horrible at it. I wouldn't mind trying this out iteratively either, I'm not looking for what's best, I'm just trying to get the job done.

Say I have a dictionary with dictionaries in them, dicts = {'a':{'b':{'c':None}, how would I add a dictionary to it assuming I didn't know how many dictionaries in it was?

Name: Anonymous 2011-03-16 20:24

>>16
You are welcome, I hope you will not drop out despite not understanding this stuff, thus decreasing the average ability of programmers and making my future salary a bit higher ^^

Also, there's an important nuance there, regarding that first fast bail out, it might have to be amended, because a trie is different from just nested dictionaries: I don't see how you can express trie('x', '') as such. That is, each node in trie should have an additional value showing that there's a string ending at that node.

Though your professor's code doesn't have anything like that, so it looks like a blind teaching the blinds, and I'm, again, happy to ensure my job security by participating!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List