The use of nested `if`

's is alright. However the OP code is complicated, repetitive and can give false positives.

Consider,

```
if x>0:
# code
else:
# code
```

Is it necessary to check the sign on a number to determine if it is an integer? Answer: No, it is not. The sign has no bearing on an integer (or float with `.0`

)

Now consider this code:

```
if x-(round(x))>0:
return True
else:
return False
```

Let x = 11.5 so that round(x) = 12. The above returns False, which is true.

Let x = 11.4 so that round(x) = 11. The above returns True, which is a false positive.

However, just this structure is enough code to do the job once we sort out the false positive. We don't need a huge structure, especially given that both main cases contain exact same code.

`return False if x - round(x) != 0 else True`

Now it doesn't matter if rounding is up or down.

As indicated in the earflier post, we don't need a function in this evaluation since we can use the modulo operator.

`return x % 1 == 0`

More particularly, if we wish to trap illegal inputs:

```
def is_int(n):
try:
return n % 1 == 0
except:
return "Type Error"
```

Numbers will pass the try expression, non-numbers will fail, and follow the exception branch.