From 076c70e72ec36e904a77659a672088812607fca0 Mon Sep 17 00:00:00 2001 From: Lukas Baumann Date: Thu, 18 Feb 2021 08:30:24 +0100 Subject: [PATCH] Create 2 - Exact Postage.py --- 14/2 - Exact Postage.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 14/2 - Exact Postage.py diff --git a/14/2 - Exact Postage.py b/14/2 - Exact Postage.py new file mode 100644 index 0000000..ca58360 --- /dev/null +++ b/14/2 - Exact Postage.py @@ -0,0 +1,12 @@ +def postalValidate(S): + S = S.replace(" ", "") + if len(S) != 6: + return False + for i in range (6): + if i%2: + if not S[i].isdigit(): + return False + else: + if not S[i].isalpha(): + return False + return S.upper()