From 10874daa5f5f3de0fcd2344cc91271529e8e0b88 Mon Sep 17 00:00:00 2001 From: Lukas Baumann Date: Wed, 17 Feb 2021 10:24:29 +0100 Subject: [PATCH] Create a3.py --- 15/a3.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 15/a3.py diff --git a/15/a3.py b/15/a3.py new file mode 100644 index 0000000..275125e --- /dev/null +++ b/15/a3.py @@ -0,0 +1,8 @@ +def execute(prog): + lines = set() + location = 0 + while True: + lines.add(location) + if location==len(prog)-1: return "success" + location = findLine(prog, prog[location].split()[-1]) + if location in lines: return "infinite loop"