The Coupon Code

Story

Your online store likes to give out coupons for special occasions. Some customers try to cheat the system by entering invalid codes or using expired coupons.

Task

Your mission:
Write a function called checkCoupon which verifies that a coupon code is valid and not expired.

A coupon is no more valid on the day AFTER the expiration date. All dates will be passed as strings in this format: "MONTH DATE, YEAR".

Examples:

checkCoupon("123", "123", "July 9, 2015", "July 9, 2015")  == True
checkCoupon("123", "123", "July 9, 2015", "July 2, 2015")  == False
PROGRAM.......
def check(temp):
    a=[]
    b=[]
    a,b=temp.split(",")
    month,date=a.split(" ")
    year=b
    dat={
        "January":"0",
        "February":"1",
        "March":"2",
        "April":"3",
        "May":"4",
        "June":"5",
        "July":"6",
        "August":"7",
        "September":"8",
        "October":"9",
        "November":"10",
        "December":"11"
    }
    return dat.get(month),date,year
enter=input()
corre=input()
flag=0
curr=input()
expi=input()
cmonth,cdate,cyear=check(curr)
emonth,edate,eyear=check(expi)
if enter==corre:
 if cyear>eyear:
  flag=1
 elif cyear==eyear:
  if cmonth>emonth:
   if cdate>edate:  
    flag=1
   elif cdate==edate:
    flag=0
  elif cmonth==emonth:
    flag=0
elif enter !=corre:
    flag=1
if flag==1:
  print("False")
if flag==0:
  print("True")

output