From tz348@nyu.edu  Sun Oct 25 21:46:51 2009
Received: from mx.cims.nyu.edu (mx.cims.nyu.edu [128.122.80.107])
	by mail.cims.nyu.edu (8.13.8+Sun/8.13.8) with ESMTP id n9Q1kouu021609
	for <shasha@mail.cims.nyu.edu>; Sun, 25 Oct 2009 21:46:50 -0400 (EDT)
Received: from mx1.nyu.edu (MX1.NYU.EDU [128.122.118.241])
	by mx.cims.nyu.edu (8.13.8+Sun/8.13.8) with ESMTP id n9Q1kn1a012327
	for <shasha@courant.nyu.edu>; Sun, 25 Oct 2009 21:46:49 -0400 (EDT)
Received: from mail.nyu.edu (H3.HOME.NYU.EDU [128.122.118.83])
	by mx1.nyu.edu (8.13.8/8.13.8) with ESMTP id n9Q1kigQ017224
	for <shasha@courant.nyu.edu>; Sun, 25 Oct 2009 21:46:44 -0400 (EDT)
Received: from [216.165.26.58] by mail.alt.home.nyu.edu (mshttpd); Sun,
 25 Oct 2009 21:46:44 -0400
From: Tengchao Zhou <tz348@nyu.edu>
To: Dennis Shasha <shasha@courant.nyu.edu>
Message-ID: <6120acec2fff54.4ae4c744@mail.nyu.edu>
Date: Sun, 25 Oct 2009 21:46:44 -0400
X-Mailer: Sun Java(tm) System Messenger Express 6.3-8.03 (built Apr 24
 2009; 64bit)
MIME-Version: 1.0
Content-Language: en
Subject: homework
X-Accept-Language: en
Priority: normal
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.58 on 128.122.80.107
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (mx.cims.nyu.edu [128.122.80.107]); Sun, 25 Oct 2009 21:46:50 -0400 (EDT)
Status: R
Content-Length: 808




print "think of a number between 1 and 1000: "

high = 1000
low = 1
mid = low + (high - low)/2

def find_num (low, mid, high):
    if mid == 1000 or mid == 1:
        print "you are lying"
    else:
        in_choice = raw_input("Is the number greater, equal to, or less than %s?" %str(mid))
        print in_choice
        if in_choice == "greater":
            low = mid +1
            mid = low + (high - low)/2
            return find_num(low,mid,high)
        elif in_choice == "less":
            high = mid
            mid = low + (high - low)/2
            return find_num(low,mid,high)
        elif in_choice == "equal to":
            print "so your number is %s" %mid
        else:
            print "sorry, please enter again."
            find_num (low, mid, high)

find_num (low, mid, high)

