So I have been doing algebra and I was asked to solve some equations. But I got stuck on two of them. I employed the help of Python to find my answer.

My first problem was `16 - 2x = 19 - 5x`

. I needed to find `x`

. I had a fair idea that the answer would be `x = 1`

but I wanted to make sure, so I asked my computer with this script:

>>> x = 0 >>> while True: ... outa = 16 -2*x ... outb = 19 -5*x ... if(outa == outb): ... print x ... x += 1 ... 1 ^CTraceback (most recent call last): File "<stdin>", line 4, in <module> KeyboardInterrupt

As you can see, I was right, the answer was `1`

(or more precisely `x = 1`

).

My second problem was `3(x + 2) = 2(x - 5)`

. Now, I had no idea what this was going to be, so I asked Python yet again with this script:

>>> x = 0 >>> while True: ... outa = 3*(x+2) ... outb = 2*(x-5) ... if(outa == outb): ... print x ... x += 1 ... ^CTraceback (most recent call last): File "<stdin>", line 2, in <module> KeyboardInterrupt

Uhh, that didn’t work. The script had been running for about while and still hadn’t told me anything! I tried again, except modified the script to use negative numbers instead of positive numbers:

>>> x = 0 >>> while True: ... outa = 3*(x+2) ... outb = 2*(x-5) ... if(outa == outb): ... print x ... x -= 1 ... -16 ^CTraceback (most recent call last): File "<stdin>", line 2, in <module> KeyboardInterrupt

There it is! `x = -16`

.

I had been told Python can be a handy pocket calculator but I didn’t know it could be this handy!