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