Which of the following statements about booleans in Python is true?
-
A
Booleans are represented as 1 and 2.
-
B
Booleans can only be assigned with the True keyword.
-
C
Booleans are a subclass of integers.
Correct answer
-
D
Booleans cannot be used in conditional statements.
Correct answer
C. Booleans are a subclass of integers.
13 views
Explanation
In Python, booleans are a subclass of integers, and True and False are instances of the bool class.
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ