0% found this document useful (0 votes)
28 views2 pages

Python Notes

The document discusses different types of operators in programming languages including relational operators, equality operators, logical operators, and bitwise operators. Relational and equality operators can be used with numeric, string, and boolean data types, while logical operators return boolean values. Bitwise operators apply only to integer and boolean values.

Uploaded by

rupesh reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Python Notes

The document discusses different types of operators in programming languages including relational operators, equality operators, logical operators, and bitwise operators. Relational and equality operators can be used with numeric, string, and boolean data types, while logical operators return boolean values. Bitwise operators apply only to integer and boolean values.

Uploaded by

rupesh reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Relational Operators

int float string bool


> Yes Yes Yes Yes
< Yes Yes Yes Yes
<= Yes Yes Yes Yes
>= Yes Yes Yes Yes
Comparison is based on
alphabatical order(ASCII True - 1
Comment code) False - 1

Equality Operators

int float string bool Complex


= Yes Yes Yes Yes Yes
!= Yes Yes Yes Yes Yes
Comparison is based on
alphabatical order(ASCII True - 1
Comment code) False - 1

Logical Operators

Boolean data type :


x Operator y o/p

Non-Boolean Operators
Returns
and x if false , returns y if true
x Operator y o/p Comments

other that "0" all are


True ,
T and T - TRUE
10 and 20 20 Returns y

other that "0" all are


True ,
T and F - False
10 and 0 10 Returns x
"" and "R" ""
Returns xorif x is true , returns y if x is false
x Operator y o/p Comments

other that "0" all are


True ,
10 - True
10 or 20 20 Returns x
other that "0" all are
True ,
0 - False
10 or 0 0 Returns y
Sample applicable in
case of strings
bitwise Operators Applicbale only for int and boolean
Non - Boolean
Bitwise and Operator (&)
x Operator y o/p Comments

100
101
---------
4 & 5 4 100-4
Bitwise and Operator (|)
x Operator y o/p Comments

100
101
---------
4 | 5 5 101-5
Bitwise exclusively or operator ^ ( if both are different then true)

100
101
---------
4 | 5 1 001-1
Bitwise complement Operator (^)

if value is negetive then 2's complement will


be done on complement output excluding
most significant bit
0 .1 0 0 1-0 1 1
most 2's compliment(add one to compliment )
siginfican 1-1 0 0
digit 0 0 1
reperesen -----------------
~4 ts sign 1.0 1 1 1 - 1 0 1 = -5

You might also like