From 82cd75137a06256df5b4eb2eecf4efbc5d7e662e Mon Sep 17 00:00:00 2001 From: deadsmond <01.lewicki@gmail.com> Date: Mon, 25 Nov 2019 20:13:04 +0100 Subject: [PATCH] 'hm' --- TaskB01/run | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/TaskB01/run b/TaskB01/run index 81887ec..cf2fd66 100644 --- a/TaskB01/run +++ b/TaskB01/run @@ -60,9 +60,13 @@ class automata: if self.graph[q]: # search through all its connections to find value for transition in self.graph[q]: - if transition[i]: - # append next node - result.append(transition[i]) + try: + if transition[i]: + # append next node + result.append(transition[i]) + except KeyError: + # there is no value like that (element from the outside of alphabet) + return [] # return list of next nodes return result