days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] happy_count = 0 for i, day in enumerate(days): for j in range(day): a = j % 10 b = j // 10 if (a + b) == (i + 1): happy_count += 1 print(happy_count)