From 298172d1aaee0bdcbbb631b2a0efc7fbf839991a Mon Sep 17 00:00:00 2001 From: lickthecheese Date: Thu, 30 Jan 2020 21:41:02 -0500 Subject: [PATCH] value checking of cir script --- bin/circomference.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/circomference.py b/bin/circomference.py index b111aea..9a7245d 100755 --- a/bin/circomference.py +++ b/bin/circomference.py @@ -1,12 +1,16 @@ #!/usr/bin/env python3 -import math +import math, sys si = input('size append d r c a> ') - +print() st = si[-1:] -si = float(si[:-1]) +try: + si = float(si[:-1]) +except: + print('invalid input, please use the format ') + sys.exit() def fromD(di): r = di/2 @@ -33,5 +37,11 @@ funcs = { 'a':fromA } -funcs[st](si) +if st in funcs: + funcs[st](si) +else: + print("invalid value type, the options are:") + for i in funcs: + print(i) +