Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
140 views
in Computer by (44.9k points)
closed by

Logical Operators.

1 Answer

+1 vote
by (44.8k points)
selected by
 
Best answer

Logical operators are fundamental blocks that can be used to build a decision-making capability in your code. When we need to make our decision based on two or more checks, it is necessary to have a combination of logical operators.

We can do things conditionally in our programs using if statements or if/else statements combined with logical operators. Logical operators work like Boolean variables and return either TRUE or FALSE.

The three most important logical operators are AND, OR and NOT.

AND 

Operator The AND operator is used to see if two or more conditions are true. If all the conditions are true, the AND operator returns TRUE. If any one of the conditions fail, the AND operator returns FALSE. In python AND operator is denoted by and keyword. Some other programming languages use “&&” as AND operator.

OR Operator 

The OR operator is used to see if either one of two or more conditions is TRUE. If any of the condition is true, the OR operator returns TRUE. If all the conditions fail, the OR operator simply returns FALSE. In python syntax OR operator is denoted by or keyword. Some other programming languages use “||” as OR operator.

NOT Operator 

We use the NOT operator to reverse or negate a condition. If the condition is true, NOT will return false and viceversa.

In python programming, not keyword is used to denote not operator. Some other programming languages use “!” as NOT operator.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 6, 2023 in Computer by Eshwarojha (44.9k points)

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...