NEW
Font size
WorksheetsOperators in Python
Total questions: 17
Worksheet time: 9mins
From logical operators
<<
is not
not in
not
From assignment operators
>>=
==
is
in
From arithmetic operators
/=
//
and
&
From comparison operators
>>
>=
=
is
From identity operators
==
in
is
=
From membership operators
=
not in
is
!=
From bitwise operators
is not
-
not
~
xy
x^^y
x^y
x**y
x pow y
10%3
3
1
9
10
10//3
3
3.3
0.3
3.0
x = x ^ 3 can also be written as
x = x pow 3
x = x ** 3
x = x XOR 3
x ^= 3
the output of: x >= y
Adjust x so that it is greater than or equal y
True if x is greater than or equal y
x is shifted y bits to the right
False if x equals y in value
x = 5
print(not(x > 3 and x < 10))
not(x > 3 and x < 10)
True
False
syntax error
What is the output of:
b=2
c=2
print(b is c)
c +=2
print(b is c)
False
False
False
True
True
False
True
True
What is the output of:
l1 = [1, 2, 3]
l2 = l1
l1[0] = 7
print (l1)
print (l2)
print (l1 is l2)
[7, 2, 3]
[7, 2, 3]
True
[7, 2, 3]
[0, 2, 3]
True
[7, 2, 3]
[7, 2, 3]
False
[7, 2, 3]
[0, 2, 3]
False
What is the output of:
x = ["apple", "banana"]
print("banana" in x)
1
True
False
2
What is the output of:
print (7&8)
print (7|8)
print (7^8)
print (7>>3)
0
15
15
0
0
15
15
224
0
15
0
0
0
0
15
0
