TDT4109/Exercise 1/8 - Vitenskapelig notasjon/common.py

7 lines
182 B
Python
Raw Normal View History

2020-08-31 23:16:07 +02:00
def inputTypeCheck(message, type, errorMessage):
while True:
inputValue = input(message)
try:
return type(inputValue)
except ValueError:
print(errorMessage)