I want to generate a sequence of numbers starting from 2 and calculating each successive number in the sequence as the square of the previous number minus one.
x = 2
while 0 <= x <= 10:
x ** 2 - 1
print(x)
note: Iam interested in finding the first number in the sequence greater than ten or less than zero
but the loop keeps repeating with the same answer of 3. how do i stop it?
xnever changes, what do you expect?python -m pdb <your-script>to debug your script and see why it won't work, when you stepwise run through your endless loop.