Q:

Python number guessing game

I have found some practice problems online and I got most of them to work, but this one has stumped me. Its not homework so I'm not getting a grade.  However, there isn't a solution provided so the only way to get the answer is by doing it. 
The task asks for you to write a problem that plays a number guessing game for numbers 1-100. However, this one tries to guess the users number by interval guessing, such as [1, 100] and generates the next question by using first+last/2. 
I have a sample run from the site.

Think of a number between 1 and 100 (inclusive).
  Answer the following questions with letters y or Y for yes and n or N for no.
  interval: [1,100]. Is your number <= 50? y
  interval: [1,50]. Is your number <= 25? y
  interval: [1,25]. Is your number <= 13? y
  interval: [1,13]. Is your number <= 7? n
  interval: [8,13]. Is your number <= 10? n
  interval: [11,13]. Is your number <= 12? y
  interval: [11,12]. Is your number <= 11? y
  Your number is:  11

Here is my code so far, but I don't even quite know where to start because a while-loop constantly gives me an infinite loop.  I know the "middle" number needs to be an integer or else it'll be an infinite loop, but I can't seem to figure out how to do that. 
x = input("Is your numbr <=50?")
count = 100
while x=="y" or "Y":
    count = count/2
    x = input("Is your number <=",count,"?")
    print(count)

If anyone has any tips it would be greatly appreciated.

A:

The entire idea of the problem is to keep both "bounds" starting at 1 and 100, and each time you make a question "is you number <= X" you discard half of the range according to the answer, you are not doing this in your current solution.
like this.
lower = 1
high = 100
mid = (high + lower)/2 -> at start it will be 50

If the user answers Yes then you take the range from the current lower bound to the mid of the range, otherwise you continue with the range starting on mid+1 to the end, like this:
If user answers Yes:
high = mid

If user answers No:
lower = mid +1

The last part of the idea is to detect when the range lower-high contains only 2 numbers, or are the same number like this [11,12], you use the final answer of the user to choose the correct answer and the program terminates, the full code is here so you can test it:
found = False
range_lower_bound = 1
range_high_bound = 100

print "Think of a number between 1 and 100 (inclusive)."
print "Answer the following questions with letters y or Y for yes and n or N for no."

while not found:
    range_mid = (range_high_bound + range_lower_bound) / 2
    x = raw_input('interval: [%s,%s]. Is your number <= %s? ' % (range_lower_bound, range_high_bound, range_mid))
    if x.lower() == 'y':
        # Check if this is the last question we need to guess the number
        if range_mid == range_lower_bound:
            print "Your number is %s" % (range_lower_bound)
            found = True
        range_high_bound = range_mid
    # here i'm defaulting "anything" no N for simplicity
    else:
        # Check if this is the last question we need to guess the number
        if range_mid == range_lower_bound:
            print "Your number is %s" % (range_high_bound)
            found = True
        range_lower_bound = range_mid + 1

Hope it helps!

