1 2 3 4 5 6 7
S = 0 for i in range(1, 10): for j in range(1, 3): if i == j: S = S + i + j break print S