Below code may help.
age=(lambda i,f: f(i,f))(input("Please enter your age: "),lambda i,f: i if i.isdigit() else f(input("Please enter your age: "),f)) print("You are able to vote in the united states" if int(age)>=18 else "You are not able to vote in the united states",end='') If you want to have maximum tries, say 3, use below code
age=(lambda i,n,f: f(i,n,f))(input("Please enter your age: "),1,lambda i,n,f: i if i.isdigit() else (None if n==3 else f(input("Please enter your age: "),n+1,f))) print("You are able to vote in the united states" if age and int(age)>=18 else "You are not able to vote in the united states",end='') Note: This uses recursion.