cnt=0 for m in range(1,13): for ten in range(4): one=m-ten dey=ten*10+one if one>=0 and one<10 : if (m in[1,3,5,7,8,10,12]) and dey<=31: cnt=-~cnt elif(m==2) and dey<=28: cnt=-~cnt elif dey<=30: cnt=-~cnt print(cnt)