ds = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] counter = 0 for m in range(12): for d in range(ds[m]): if m + 1 == (((d + 1) // 10) + ((d + 1) % 10)): counter = counter + 1 print(counter)