The other answers are fine. Here is a mathematical analysis of the problem you're trying to solve.
If this code is, for some reason, used in a performance-critical scenario, you can calculate the sum to \$m\$ in \$O(1)\$ time.
Notice that:
$$
\begin{align}
1-2+3-4+5-6\dots m &= -\sum_{n=1}^{m}n(-1)^n \\
&= \sum_{n=1}^{m}n(-1)^{n-1} \\
&= \frac{1}{4}-\frac{1}{4}(-1)^m(2m+1) \; ^*
\end{align}
$$
* There was a typo in my original comment.
Because you only want to see every 10th result, we can substitute \$m=10u\$ where \$u\in\mathbb{Z}\$. This is fortunate because for all integers \$(-1)^{10u} \equiv 1\$. Therefore:
$$
\begin{align}
\frac{1}{4}-\frac{1}{4}(-1)^{10u}(20u+1) &= \frac{1}{4}-\frac{1}{4}(20u+1) \\
&= \frac{1}{4}-\frac{20u+1}{4}\\
&= \frac{(1-1)-20u}{4} \\
&= -5u
\end{align}
$$
Look familiar? It results in \$-5\$, \$-10\$, \$-15\$, ...
This fact is obvious from the output, but now knowing the series that produces it, we can calculate the final result for any such \$m\$ quickly, and every 10th value even easier.
We can avoid computing the exponent \$(-1)^m\$ because \$(-1)^{m} = 1\$ for even values of \$m\$ and \$-1\$ for odd values.
I'm not as familiar with Python, but here's an example:
def series(m):
alt = 1 if m % 2 == 0 else -1
return int(1/4 - 1/4 * alt * (2 * m + 1))
def series_progress(m):
return -5 * m
m = 134
for i in range(1, m // 10):
print(series_progress(i))
print(series(m))
This avoids the costly computation for the final result. If we just needed the result it would be \$O(1)\$, but because we give "progress reports" it is more like \$\lfloor\frac{n}{10}\rfloor\in O(n)\$.
result
of the whole sum and just want to report progress as the summing is going on, or do you want the sum of only every 10th element and also print progress? \$\endgroup\$ – Graipher Dec 10 '18 at 15:29