Boolean

    • The boolean data type represents the concept of truth values, which can be either True or False.
    • Basically what happens is , when you compare two values, the expression is evaluated and Python returns the Boolean answer.
    • True represents a true condition or the value “1”.
    • False represents a false condition or the value “0”.
    • Empty values for example an empty list [] , an empty dictionary {} or an empty string “” is evaluated to False.
    • The number 0 , value None and the value False evaluates to False.
    • Any number except 0 is evaluated to True.
    • Any string , except empty string is evaluated to be True.

FUNCTIONS RETURNING A BOOLEAN VALUE

    • Functions in Python can return boolean values just like they can return any other type of value.
    • Let us learn the same using an example.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x