month = [1,2,3,4,5,6,7,8,9,10,11,12] days = [31,28,31,30,31,30,31,31,30,31,30,31] count=0 for m in month: for day in range(1,days[m-1]+1): if m == day//10 + day%10: count+=1 print(count)