put the range check AFTER the input()

for the third time