-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyPlus.py
34 lines (29 loc) · 1.03 KB
/
pyPlus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def title(text):
if isinstance(text, str):
print("======================================")
print(text)
print("======================================")
else:
raise TypeError("INPUT ERROR: Input not STR")
def inputForceType(text, varType):
while True:
var = input(str(text))
if varType == str:
return var
elif varType == int:
try:
int(var)
except ValueError:
title("INPUT ERROR: Expected input of type INT")
else:
return int(var)
elif varType == float:
try:
float(var)
except ValueError:
title("INPUT ERROR: Expected input of type FLOAT")
else:
return float(var)
else:
raise TypeError("DUMBASS: You out here making sure the user doesn't input somehting wrong and you go and type \""+str(varType)+"\"")
help("module")