what are "and" and "or" operators in Python?

0 votes
I am confused with "and" and "or" operators. when are they used?
Apr 17, 2018 in Python by ana1504.k
• 7,870 points
41 views

1 answer to this question.

0 votes

AND - True if both the operands are true

OR - True if either of the operands are true

Consider the example below:

a = 58        # 111010

b = 13        # 1101

c = a & b     

print ( c )   # 8 = 1000

c = a | b      

print ( c )   # 63 = 111111
answered Apr 17, 2018 by Johnathon
• 9,070 points

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Can someone explain the behaviour of increment and decrement operators in python

down voteaccepted ++ is not an operator. It is ...READ MORE

answered May 15, 2018 in Python by ariaholic
• 7,340 points
318 views
0 votes
2 answers

What are the types of dictionary in python?

There are 4 types of dictionary Empty Integer Mixed Dictionary with ...READ MORE

answered Feb 14 in Python by Shashank
• 1,350 points
48 views
0 votes
1 answer

Behaviour of increment and decrement operators in Python

When you want to increment or decrement, ...READ MORE

answered Jul 26, 2018 in Python by Priyaj
• 56,520 points
604 views
0 votes
0 answers

what is a bitwise operator in python?

can you show some operations using bitwise ...READ MORE

Apr 8 in Python by Waseem
• 4,230 points
23 views
0 votes
0 answers

what is the logical AND operator in python?

how do i use it in a ...READ MORE

Apr 12 in Python by Waseem
• 4,230 points
26 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 173 views
+1 vote
3 answers
0 votes
3 answers

What is python? Where it is used?

 Python is develop by Guido Van Rossum ...READ MORE

answered Mar 18 in Python by rajesh kumar
54 views