✓ Accepted answer
Let's imagine you have three variables.
number = 15
one = 1
two = 2
Let's say we're going to make number into one:
number = one
And then change it into two:
number = two
Our whole program looks like this then:
number = 15
one = 1
two = 2
number = one
number = two
So the question is... What is the value of one at the end of that?
It's not 15 -- we never assigned to one -- one was never on the left side of an equals sign.
The variable we are changing is always on the left. We can't pick-and-choose where we use the left or the right, because code like the above is ambiguous would be ambiguous when there's one variable on each side.
Flip your assignment around:
h3[1] = h[1] - h2[1]
Now the first element of h3 is the difference between the first elements of h and h2.
As a note, it might be a little better to use the name h1 instead of just h since the others use numbers. What might be better is to use distinct letters, like f g h or a b c.
1 comment
Thanks, H was just an example, I have other variable names neatly organized.