May-28-2018, 08:16 PM
(May-28-2018, 06:41 PM)pyhelp Wrote: The below code works fine but how to handle the error, if a user inputs any month or type anything other than the months listed below.You use the same
get()
method as i showed in previous post you,so it handles error.A run of your code:
>>> pick_month() Input Month as January, February, March, April, May, or June? April 04 Input Month as January, February, March, April, May, or June? car Month not found >>> pick_month() Input Month as January, February, March, April, May, or June? 12345 Month not found >>> pick_month() Input Month as January, February, March, April, May, or June? June 06