From 31c57cf4b85cb1579265febaf82148e0f7460077 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Wed, 25 May 2022 13:44:07 +0200 Subject: [PATCH] Accounting --- bokforing.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bokforing.py diff --git a/bokforing.py b/bokforing.py new file mode 100644 index 0000000..b659fff --- /dev/null +++ b/bokforing.py @@ -0,0 +1,20 @@ +n, q = map(int, input().split(" ")) +d = 0 +p = {} +for _ in range(q): + e = input().strip() + + if e[:3] == "SET": + i, x = map(int, e[4:].split(" ")) + p[i] = x + + elif e[:5] == "PRINT": + i = int(e[6:]) + try: + print(p[i]) + except KeyError: + print(d) + + elif e[:7] == "RESTART": + d = int(e[8:]) + p = {} \ No newline at end of file