# use the running total pattern to accumulate the result result = '' for i in range(10): value = i + 1 if value % 2 == 0: result += (str(value) + ' ') print(result)