I am still currently working on exercise 5 that is due at
midnight tonight. I have completed my code for e5a.py, and I got full marks for
it. However, e5b.py is giving me quite a bit of trouble. I understand what
should be returned from the leaves_and_internals function, and I understand
which items in BTNode are leaves (items that have no children) and which are internals (items
that have at least one child). Here is an example of what is produced when I
test my code in the shell:
>>> a = BTNode(3, BTNode(4, None, BTNode(1)),
BTNode(6, None, BTNode(9)))
>>> a.leaves_and_internals
<bound method BTNode.leaves_and_internals of
<__main__.BTNode object at 0x102f346d0>>
I have no idea why a.leaves_and_internals returns what it
returns, when in my code, I made it return (leaves, internals).
Anyways, I will continue to work on e5b.py for the rest of
the evening, and hopefully I can figure out what I am doing wrong!
If you had similar problems in your current assignments, make sure to go to the office hours, and ask them :-)
ReplyDeleteI definitely will!
ReplyDelete