while True: mes = input('Digite o mês inicial:') if len(mes) == 2: break; print ('Valor inválido! O mês deve ter 2 dígitos.') mes1 = int(mes) print(mes1) #https://pt.stackoverflow.com/q/418413/101