I'm writing a game that prompts the user to input the number of rows. The problem I'm having is how do I get the program to keep prompting the user until they enters a whole number. If the user enters a letter or a float such as 2.5, the int value will not work, and thus I cannot break out of the loop. The program crashes. The int is essential so that I can check the number. The input must be even, it must be greater then or equal to 4 and less then equal to 16. Thanks!
def row_getter()->int:
while True:
rows=int(input('Please specify the number of rows:'))
if (rows%2 == 0 and rows>=4 and rows<=16):
return rows
break