-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReader.py
More file actions
25 lines (22 loc) · 740 Bytes
/
Reader.py
File metadata and controls
25 lines (22 loc) · 740 Bytes
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
#reads valid integer within min, max values. doesnt return program control until valid int value is inputted
def ReadInt(Min, Max):
value = 0
while True:
try:
value = int(input(">> "))
if (value < Min) or (value > Max):
print("VALOR FUERA DE RANGO!")
else:
return value
except:
print("INGRESE SOLO NUMEROS")
# message to print, message on except, returns a valid int value after success int value is readed
def intReader(msgToPrint, ErrorMsg):
ValueToReturn = 0
while True:
try:
ValueToReturn = int(input(msgToPrint))
break
except:
print(ErrorMsg)
return ValueToReturn