very very basic question

Larry Bates larry.bates at websafe.com
Sun Apr 2 17:30:08 EDT 2006


aghazalp wrote:
> thanx ...it works great now...you re awesome...the only thing is that
> the program only executes once though...I guess I ll have to read up
> more anout it but for now that helped me a lot...I appreciated the help
> 

It only executes once because you only call it once.

Your program:

def main():
    print "this program is crazy"
    x=input ('enter a number betwenen 0 and 1: ')
    for i range (10)
        x=3.9*x*(1-x)
        print x

main()

Change to something like:

def main():
    print "this program is crazy"
    while 1:
        x=input ('enter a number between 0 and 1 [-1 to exit]: ')
        if x == -1: break
        for i range (10)
            x=3.9*x*(1-x)
            print x

main()


-Larry Bates



More information about the Python-list mailing list