Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 25)
25.
How can you read a boolean value from the console?
bool(input())
read_boolean()
input().to_bool()
bool(input().lower() == 'true')
Answer: Option
Explanation:
To read a boolean value from the console in Python, you can compare the input (converted to lowercase) with the string 'true'.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.