i wrote a program that guesses number in the most effective way i could 
think of but i keep running into endless loops any help fixing it would be 
great :)

here it is:


def num(number):
    r=input("range >")
    ran=range(r+1)
    guess=r/2
    print guess
    guesses=1
    while guess!=number:
        if guess < number:
            guess= ((r-guess)/2)+guess
            print guess
            guesses=guesses+1
        elif guess > number:
            guess= ((r-guess)/2)-guess
            print guess
            guesses=guesses+1
    print "i got the number",number,"in",guesses,"guesses"



my only idea is to make it so it dosint re guess numbers but i would rather 
just find out what is wrong
and fix it

_________________________________________________________________
Express yourself - download free Windows Live Messenger themes! 
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/themes/vibe/default.aspx?locale=en-us&source=hmtagline

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to