diff --git a/TaskB01/run b/TaskB01/run index fa18ae1..2720730 100644 --- a/TaskB01/run +++ b/TaskB01/run @@ -58,13 +58,15 @@ class automata: def get_node_transition(self, q, i): result = [] # if the node exists - if self.graph[q]: + try: # search through all its connections to find value for connections in self.graph[q]: for value in connections: if value == i: # append next node result.append(connections[value]) + except KeyError: + return result # return list of next nodes return result