Using a while loop with a couple of prewritten prompts helps keep the inputs contained.
prompt = ['Enter 1 or 2: ', 'Invalid input... Enter 1 or 2: ']
i = 0
num = '0' # note that an empty string won't work
while num not in '12':
num = input(prompt[i])
i = 1
num = int(num)