Boolean
Jan 11, 2024 by Ankit Srivastava
Categories
Enroll Now to Access Multiple Intensive Courses for Free
- 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.
- Share:
No comments yet! You be the first to comment.