Question: I expect the output as 

```
[1,4,9,10,#]

```

but I am getting 

```
[1,4,9,10]

```

Can anyone explain the reason as to why is that happening?

```
str = "adij"
mainstr = []
for i in range(0, len(str)):
    if 97 <= ord(str[i]) <= 107:
        mainstr.append(ord(str[i]) - 96)
    if ord(str[i]) > 107:
        mainstr.append(ord(str[i]) - 96)
        mainstr.append('#')
print mainstr

```

Answer: 
It's because `ord(str[i])` is never greater than `107`:

```
>>> ord("j") > 107
False
>>> ord("j")
106

```

therefore `mainstr.append("#")` is never even reached.

---

Other things you should fix:

* you should never call your variable `str`, `str` already means something (it's the [string class](https://docs.python.org/2/library/functions.html#str))
* In Python, you can compare strings directly. Use `"a" <= str[i] <= "k"`.
* You can just iterate over the characters in a string without a counter:

```
for character in theString:
    if "a" <= character <= "k":
        # ...

```
Character 107 is `'k'`. There are no characters in your string that follow `'k'` lexicographically, so the `if` statement that contains `mainstr.append('#')` is never triggered. The code that would add `'#'` to your list is never executed.