So, I'm making a Python 3 program where it tells you to enter a rational number, converts that number into a floating point, passes it through a while loop where it actually iterates, then notifies the user if its bound or unbound (basically seeing if the program fits in the Mandelbrot set). My issue resides in the last part. I'm trying to make it check if the value run through the while loop is greater than than the original value, and if it is it'll print it's unbound. The same will happen vice versa. (I'm trying to do it all in an if/else) How do I refer to that original value though? Sorry if my question is bad I'm 12 and new to programming. Here's my code:
print('The best Mandelbrot iteration from Python!')
print('Please enter any rational you would like to check if it belongs to the Mandelbrot set.')
z = 0
c = input()
cc = c.replace(',', '.')
ccc = float(cc)
n = 0
while z < 1000 and n < 15 :
print( str(z) + (', ') + ( 'Count: ' + str(n) ) )
z = z**2 + ccc
n = n + 1
I've tried to make it print bound/unbound based on how many times it iterates. The program originally lasted forever if it was unbound. What I mean is this (n is the counter) :
if n >= 3:
print('Unbound!')
elif n < 3:
print('Bound!')