On 13/11/12 03:56, Rufino Beniga wrote:
def IterateLogistic(x,r,n):
for i in xrange(n):
x = r*(1-x)
if i = n:
print x
DogWalker has answered your basic question.
But you don't really need the test at all.
Just print x after the loop finishes:
def IterateL
On Monday 2012 November 12 21:07, you wrote:
> I tried it with i == n as well and it still doesnt work :/
Check the documentation on range and xrange and you will find out why i never
equals n.
>>> n = 5
>>> range(n)
[0, 1, 2, 3, 4]
>>> for i in xrange(n): print i
...
0
1
2
3
4
>>>
--
Yonder no
On Monday 2012 November 12 19:56, Rufino Beniga wrote:
> def IterateLogistic(x,r,n):
> for i in xrange(n):
> x = r*(1-x)
> if i = n:
> print x
>
> I want this function to take in x and r which can be any two real numbers
> and after a certain number of iterations (n)
def IterateLogistic(x,r,n):
for i in xrange(n):
x = r*(1-x)
if i = n:
print x
I want this function to take in x and r which can be any two real numbers
and after a certain number of iterations (n), the function should print the
current state which is x. I tried this