Boolean (bool) Data Type (बूलियन डेटा टाइप) :-
Boolean (बूलियन) Python का एक Built-in Data Type है, जिसका उपयोग किसी Condition (शर्त) या Expression (व्यंजक) के परिणाम को दर्शाने के लिए किया जाता है।
Boolean Data Type में केवल दो ही Values होती हैं:
जब भी Python में किसी दो Values की तुलना (Comparison) की जाती है, कोई Logical Operation किया जाता है या किसी Condition की जाँच की जाती है, तब परिणाम Boolean Value (True या False) के रूप में प्राप्त होता है।
उदाहरण के लिए यदि पूछा जाए कि 5, 3 से बड़ा है या नहीं, तो इसका उत्तर केवल दो में से एक होगा—
इसी कारण Boolean Data Type का उपयोग मुख्य रूप से Decision Making (निर्णय लेने) में किया जाता है।
Boolean शब्द का नाम प्रसिद्ध अंग्रेज़ गणितज्ञ George Boole के नाम पर रखा गया है।
example 1-
example 2-
Boolean is a Built-in Data Type in Python that is used to represent the result of a condition or an expression.
A Boolean data type can store only two values:
Whenever two values are compared in Python, a logical operation is performed, or a condition is evaluated, the result is returned as a Boolean value (True or False).
For example, if you ask whether 5 is greater than 3, the answer can only be one of the following:
For this reason, the Boolean data type is mainly used for decision making in Python programs.
The term Boolean is named after the famous English mathematician George Boole, who developed Boolean Algebra, the foundation of modern computer logic.
example-