Austin - 1 year ago 150

Python Question

I am more interested in finding out why this doesn't work

`x = -16`

ans = -1

ans2 = 1

while (ans*ans2 > x):

ans = ans - 1

ans2 = ans + 1

print ans, ans2

Answer

You have a small typo in your code:

```
x = -16
ans = -1
ans2 = 1
while (ans*ans2 > x):
ans = ans - 1
ans2 = ans2 + 1 # changed ans with ans2
print ans, ans2
```

Output:

```
4 -4
```