Posts

Showing posts from February 6, 2019

Batch XML Editing - recommendations?

Image
0 I have several hundred XML files where there is a < filename > tag that stored the file name. I've since renamed the file names, and was wondering what the approach would be to update the tag in the file itself. Any direction would be appreciated! batch xml share | improve this question asked Jan 17 at 16:53 oweniverson oweniverson 1 2 add a comment  |  ...

Printing every 10th result in an alternating ± series

Image
12 4 $begingroup$ Problem: In the following expression 1-2+3-4+5-6 ... -98+99-100 , print result every 10th (10, 20, 30, ...) calculation. My code: result = 0 operand = 1 counter = 0 for i in range(1, 101): result = result + (i * operand) counter = counter + 1 operand = operand * -1 #Convert between positive and negative number if counter >= 10: counter = 0 print(result) My problem: I think this code has not good readability. For example, I used * -1 for changing positive and negative number. But it requires math skill(multiplying a negative number) to understand code. And I don't sure variable name 'counter' and 'operand' is appropriate for this context. Is there any suggestion? python ...