TDT4109/Exercise 1/8_-_Vitenskapelig_notasjon/common.py

7 lines
182 B
Python

def inputTypeCheck(message, type, errorMessage):
while True:
inputValue = input(message)
try:
return type(inputValue)
except ValueError:
print(errorMessage)