From 9e611363cecad6761e882785807aa4e150711738 Mon Sep 17 00:00:00 2001 From: Lukas Baumann Date: Wed, 17 Feb 2021 11:00:51 +0100 Subject: [PATCH] Create 2.py --- 15/b/2.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 15/b/2.py diff --git a/15/b/2.py b/15/b/2.py new file mode 100644 index 0000000..a0b537e --- /dev/null +++ b/15/b/2.py @@ -0,0 +1,17 @@ +def check(S): + if len (S.replace(" ", "")) != 16: + return False + for i in range(len(S)): + if i%5==4: + if S[i] != " ": + return False + else: + if not S[i].isdigit(): + return False + + x = 0 + for i in S.replace(" ", ""): + x += int(i) + if not x%10: + return True + return False