Predict the output of type(True +False) None of these
<class 'bool'>
<class 'int'>
<class 'str'>
None of these
Answers
Answered by
1
Answer:
<class 'bool'>
Reason
it can be boolean. Because boolean express any output in terms of true and false.
it cannot be string. because string is always enclosed within double qoutes.
it cannot be integer because integer expresses something related to numerals and digits.
Answered by
5
Answer:
Option 2: <class 'int'>
Note:-
- Many students often gets confused in this kind of questions and say that it will be <class 'bool'> . No, It is completely wrong.
Reason:-
- In python, any non-zero number means true and 0 means false.
- Actually, int value of True is 1 and that of False is 0.
- If you add True and False, it will change to integer format i.e. True=1 and False=0
- So here what's happens...
type(True+False)
>> type(1+0)
>> type(1)
- 1 is an integer of int data type, it will return <class 'int'>
Similar questions