Python operators questions
What is the difference between βisβ and β==β in Python?
In Python, is is an identity operator and checks to see if its right operand and left operand have the same identity or not (whether both right operand and left operand have the same memory address or not)
In Python, == is a comparison operator and checks to see if its right operand and left operand have the same value or not
What would be the result of executing the following code?
1.0 // 2 |
0
0.0
0.5
1
|
Which of the following is not a difference between is and ==?
|
is cannot be overloaded
is returns True if both operands have the same memory address
== cannot be overloaded
== returns True if both operands have the same value
|
What would be the output of executing the following code?
[] and 5 |
[]
5
True
False
|
What would be the output of executing the following code?
[1, 2, 3] and 1 + 2 + 3 |
[1, 2, 3]
True
6
1
|
What would be the result of executing the following code?
-100 // 33 |
-3
-3.0
-4
-4.0
|