Python user input and date conversion
<p>I'm trying to create this program for class but I have a tiny issue. I always seem to have problems with loops! The program works if you enter the date as asked, but I can't get it to go back and ask the user for the date again if the input is wrong. I created the True/False boolean but it doesn't seem to work. We haven't learned how to import certain date modules and convert so I'm converting the months manually.</p>

<p>Instructions: </p>

<p>A. Input a date in numeric format from the user e.g. mm/dd/yy. </p>

<p>B. Examine the month entered by the user. If it is larger than 12 or smaller than 1 issue an error message and ask for input again. </p>

<p>C. Perform similar validation tests for the date and year.    Year must 
be 2013. (Any other year is invalid). In addition, the year must only be two digits long.</p>

<p>D. Once all the input has been validated, output the string in long date format. Thus a string that was input at 06/01/15 will be output as June 1, 2015.</p>

<pre><code>def main():
    try_again = True
    while try_again == True:
        date_string = input("Please enter a date in the format 'mm/dd/yy': ")
        date_list = date_string.split('/')

        month = date_list[0]
        day = date_list[1]
        year = date_list[2]

        if month &gt; "12" or month &lt; "01":
            print('Error, please re-enter the date!')

        if year != '13':
            print('Error! The year must be 2013')

        if len(year) &gt; 2:
            print('Error! The year can only be 2 digits long!')

        else:
            print_date(month, day, year)
            try_again = False



def print_date(month, day, year):

# Convert to 2013 because 2013 is the only valid year
# for this program.

if year == '13':
    year = '2013' 

# Convert the number values to the actual month.

if month == '01':
    month = 'January'
if month == '02':
    month = 'February'  
if month == '03':       
    month = 'March'
if month == '04':
    month = 'April'
if month =='05':
    month = 'May'
if month == '06':
    month = 'June'
if month == '07':
    month = 'July'
if month == '08':
    month = 'August'
if month == '09':
    month = 'September'
if month =='10':
    month = 'October'
if month == '11':
    month = 'November'
if month == '12':
    month = 'December'


# Print the date in the correct format 
print(month + " " + day + ',' + " " + year)


main()
</code></pre>