TDT4109/Exercise 1/11 - James Bond and Operation Round/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)