def function(x,initial):
    function_value = x*x + initial #This is where you can set the function you want to investigate.
    return function_value


print "This program will let you evaluate composite functions of complex iteratively."
print "For example, you can find f(f(f(x)))."

a = float(input("Enter the real part of the initial value for x:"))
b = float(input("Enter the imaginary part of the initial value for x:"))
N = int(input("How many times do you want to calculate the value of the function? "))

x = complex(a,b) #This creates the complex number you entered using the Python language.


#DO NOT CHANGE ANYTHING ABOVE THIS LINE!
new_value = x    
for i in range(N):
    new_value = function(new_value,x)
    print "N = " + str(i)+ ", x = " + str(new_value)