The digits 0, 1, and 8 look much the same if rotated 180 degrees on the page (turned

upside down). Also, the digit 6 looks much like a 9, and vice versa, when rotated 180
degrees on the page. A multi-digit number may also look like itself when rotated on the
page; for example 9966 and 10801 do, but 999 and 1234 do not.
You are to write a program to count how many numbers from a given interval look like
themselves when rotated 180 degrees on the page. For example, in the interval [1..100]
there are six : 1, 8, 11, 69, 88, and 96.
Your program should take as input two integers, m and n, which define the interval to be
checked, 1 ≤ m ≤ n ≤ 32000. The output from your program is the number of rotatable
numbers in the interval.
You may assume that all input is valid.
Input/output is not from/to files for this question. Keyboard input and screen output is
expected.
Sample Session User input is in italics.
Enter the lower bound of the interval:
1
Enter the upper bound of the interval:
100
The number of rotatable numbers is:
6

I am kind of stuck withe logic... help me please.

See response at:

http://www.jiskha.com/display.cgi?id=1300048949

To solve this problem, you can loop through each number in the given interval and check if it looks like itself when rotated 180 degrees.

Here's the step-by-step logic to solve this problem:
1. Read the lower bound of the interval from the user and store it in a variable, let's say `lower_bound`.
2. Read the upper bound of the interval from the user and store it in a variable, let's say `upper_bound`.
3. Initialize a variable `count` as 0 to keep track of the number of rotatable numbers.
4. Iterate through each number in the range from `lower_bound` to `upper_bound + 1`.
5. For each number, convert it to a string and reverse it. Check if the reversed string is equal to the original string. If it is, then the number is rotatable.
- To reverse a string, you can simply use string slicing with a step of -1, like `reversed_string = number_string[::-1]`.
6. If the number is rotatable, increment the `count` by 1.
7. Once the loop is finished, display the value of `count` as the number of rotatable numbers in the given interval.

Here's a Python code snippet that implements the above logic:

```python
lower_bound = int(input("Enter the lower bound of the interval: "))
upper_bound = int(input("Enter the upper bound of the interval: "))

count = 0

for number in range(lower_bound, upper_bound + 1):
number_string = str(number)
reversed_string = number_string[::-1]

if number_string == reversed_string:
count += 1

print("The number of rotatable numbers is:")
print(count)
```

By following this logic, you should be able to count the number of rotatable numbers in the given interval.