hey i just started python.. i know this is a useless stupid program but i still cant get it right..:(
here i want the user to enter date in dd/mm/yyyy fashion and return the date in words. eg. 12/12/1912= 12th December,1912
but it doesnt work.. it only works for 29 feb, but all other dates the output is invalid date..plz help!!
'''date'''
datein=raw_input("Plz enter date in dd/mm/yyyy format:")
day,month,year=datein.split('/')
mnth=[None,'January','February','March','April','May','June','July','August','September','October','November','December']
chk={"2":28}
for i in [1,3,5,7,8,10,12]:
chk[i]=31
for i in [4,6,9,11]:
chk[i]=30
idx=[None,'st','nd','rd']#for adding the 'th' and stuff in the date
idx+=17*['th']
idx+=['st','nd','rd']
idx+=7*['th'];
idx.append('st')
if month==2 and day==29:
print "29th February,"+year
print
elif month <=12 and (int(day)<=chk[str(month)]):
print day + idx[int(day)] + mnth[int(month)]+", "+ year
print
else:
print "Invalid date entered"