i have a problem with my python class. it contains a method that goes through all the keys of a multi_dimensional dictionary. The dictionary keys may be in the following order (1->(2,3),2->(5,6)). the problem is when the method attempts to get the keys, sometimes it gets them in the right order (1,2) and sometimes it gets them in the wrong order (2,1). any help will be appreciated. below is a very simple example of what the code might look like
\
class tree:
tree_as_string = ""
def __init__(self):
self.id = ""
self.daughters = {1 = 'node0', 2 = 'node1'}
def get_as_string(self):
s = ''
for key in self.daughters:
tree_as_string = s.join([tree_as_string, key])
return tree_as_string