From 1be9173e40ce5b60cd085ed67f83bb9540d6f6e6 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Mon, 27 Apr 2015 18:21:30 +0200 Subject: [PATCH] Check in three-minutes-code version of verifier --- verifier.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 verifier.py diff --git a/verifier.py b/verifier.py new file mode 100755 index 0000000..cd94f46 --- /dev/null +++ b/verifier.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys + +def verifier(i1, i2): + try: + if int(max(i1, i2)) / 2 + 7 > int(min(i1, i2)) or int(min(i1, i2)) < 14: + return False + return True + except ValueError: + raise ValueError("Arguments must be integers.") + +if __name__ == "__main__": + try: + if verifier(*sys.argv[1:]): + print("Have fun.") + else: + print("Nope.") + except TypeError: + raise ValueError(sys.argv[0] + " takes exactly two arguments.")