Tolak input yang tidak valid menggunakan loop di Python
take input
while incorrect input:
take input
#Eg. Taking the month input for the first quarter of the year.
months = ['january', 'february', 'march']
month = input('Select the month').lower()
while month not in months:
month = input('Oops! Incorrect input. Select month again').lower()
Kwams