```
def is_int(x):
if abs(x) - int(abs(x)) > 0:
return True
else:
return False
```

This is the code i am trying here, can anyone please explain why is not working

```
def is_int(x):
if abs(x) - int(abs(x)) > 0:
return True
else:
return False
```

This is the code i am trying here, can anyone please explain why is not working

`if abs(x) - int(abs(x)) > 0:`

, do you understand what this line does?

if the value is greater then 0, it means you have a decimal value (other then 0), so False should be returned, yet you return True

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.