reject invalid input using a loop in python

Solutions on MaxInterview for reject invalid input using a loop in python by the best coders in the world

showing results for - "reject invalid input using a loop in python"
Wyatt
13 Feb 2016
1take input
2while incorrect input:
3    take input
4    
5#Eg. Taking the month input for the first quarter of the year.
6months = ['january', 'february', 'march']
7month = input('Select the month').lower()
8while month not in months:
9  month = input('Oops! Incorrect input. Select month again').lower()
10  
11
12