Don’t understand this simple code:
def main():
print ("This program illustrates a chaotic function")
x = float(input("Enter a number between 0 and 1: "))
for r in range(1,10):
x = 3.9*x*(1 - x)
print(x)
According to my understanding it should print out 10 identical numbers.
But it gives me 10 different. I thought that range (1,10) only means that it
iterates trough code 10 times.
rchanges from 1 to 9.xchanges from"old x"to"new x" = 3.9*(old x)*(1 - (old x))9 times, starting from the input value.