Here i am checking the isinstance function in which Sir said True is of type int but i am checking it for bool its also showing true
Isinstance(true,int) is also true and isinstance(true,bool) is also true?
Hi @Subrat
The above behavior is correct and the reason behind is that the bool type inherits from int . Because True and False are (in the sense of inherit from) integers, we can do arithmetic on them. We can even use boolean expressions as numbers (although doing so might result in obscure code).
Hope this help!
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.