• In python, we have the logical operator.
  • "Logical operator" used to perform the different logical operations on the value of variables.
  • The logical operators are applicable for boolean and non-boolean types.
  • Boolean types are:
  • True, False
  • non-boolean types are :
  1. 0
  2. 1
  3. empty string. 
  • Here True means 1 and Flase means 0.      
  • There are three different types of logical operators, they are :
  1. And
  2. or
  3. Not
  •   And operator: And operator is used when both arguments are True then the result is True.
  • syntax:  x and y

Example: write a python code for And operator.

1.a=10
2.b=20
3.print(a>30 And b<30)
4.False



  •  or operator: or operator is used when at least any one of the arguments is true then the result will be True.
  • syntax: x or y

Example: Write a python code using the or operator.

  1. a=2
  2. b=5
  3. print(a<3 or b>)



  • not operator: not operator is the opposite to the result of an argument, if it is true then the result is False and vice-versa.
  • syntax: x not y

Example: write a python code using the not operator.

  1. x=5
  2. y=10
  3. print(not x==y)
  4. True

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu