Logical Operators (लॉजिकल ऑपरेटर) :-
Logical Operators (लॉजिकल ऑपरेटर) वे Operators हैं जिनका उपयोग दो या दो से अधिक conditions या expressions को जोड़ने (Combine) और उनके बीच Logical Decision लेने के लिए किया जाता है। इनका result हमेशा Boolean value True या False होता है।
Python में Logical Operators का उपयोग मुख्य रूप से multiple conditions को check करने के लिए किया जाता है, जैसे कि सभी conditions True हैं या कोई एक condition True है या नहीं।
English
Logical Operators are used to combine two or more conditions or expressions and perform logical operations between them. They always return a Boolean value True or False as a result.
These operators are commonly used in conditional statements, loops, and decision-making programs.
Syntax -
Python में Logical Operators के मुख्य 3 Types होते हैं:
The Logical AND Operator (and) is used to check whether both conditions are True or not.
Logical AND Operator (and) का उपयोग यह जाँचने के लिए किया जाता है कि दोनों conditions True हैं या नहीं।
यदि दोनों conditions True होती हैं, तो result True होता है। यदि किसी एक condition का result False होता है, तो result False होता है।
Syntax -The Logical OR Operator (or) is used to check whether at least one condition is True.
Logical OR Operator (or) का उपयोग यह जाँचने के लिए किया जाता है कि कम से कम एक condition True है या नहीं।
यदि किसी एक condition का result True होता है, तो पूरा result True होता है। केवल तब result False होता है जब सभी conditions False हों।
Syntax -The Logical NOT Operator (not) is used to reverse or invert the Boolean result of a condition.
Logical NOT Operator (not) का उपयोग किसी condition के Boolean result को उलटने (Reverse) के लिए किया जाता है।
यदि condition का result True है, तो not उसे False कर देता है।
यदि condition का result False है, तो not उसे True कर देता है।