From 2dfadfd588555f28aa88557270a9604606d9b907 Mon Sep 17 00:00:00 2001 From: deadsmond <01.lewicki@gmail.com> Date: Mon, 25 Nov 2019 20:49:27 +0100 Subject: [PATCH] 'hm' --- TaskB01/run | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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