value checking of cir script
This commit is contained in:
parent
7518a264b8
commit
298172d1aa
1 changed files with 14 additions and 4 deletions
|
@ -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:]
|
||||
|
||||
try:
|
||||
si = float(si[:-1])
|
||||
except:
|
||||
print('invalid input, please use the format <value><type letter>')
|
||||
sys.exit()
|
||||
|
||||
def fromD(di):
|
||||
r = di/2
|
||||
|
@ -33,5 +37,11 @@ funcs = {
|
|||
'a':fromA
|
||||
}
|
||||
|
||||
if st in funcs:
|
||||
funcs[st](si)
|
||||
else:
|
||||
print("invalid value type, the options are:")
|
||||
for i in funcs:
|
||||
print(i)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue