Which of the following is/are not a valid operator in python?
(a) - =
(b) or
(c) > =
(d) = !
Answers
(d) =! is the invalid operator among the given options.
(a) -=
- This is an assignment operator, that first subtracts and then stores the result into the variable it's assigned to.
For example:
>>> num = 7
>>> num -= 4
>>> print(num)
3
#what happens is num's value, [7] gets subtracted by 4, and the resultant value becomes the new value of the variable 'num'.
(b) or
- This is a logical operator that returns 'True' only if both sides of the operator/one side of the operator are/is a True value(s).
For example:
>>> n1 = 7
>>> n2 = 9
>>> n1 == 7 or n2 == 9
True
#returns 'True' since both the relations are true.
(c) >=
This is the greater than or equal to operator. It returns 'True' if a value is greater than/equal to another value.
For example:
>>> 7 >= 8
False
#returns 'False' since 7 is not greater than/equal to 8.
(d) =!
- This isn't a valid operator. The correct operator for the not equal to operation, is !=.
For example:
>>> 7 != 10
True
#returns 'True' since 7 is not equal to 10.
▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖
EXTRA INFORMATION
➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖
a) -=
‣ -= Орerаtоr (Visuаl Bаsiс)
Орerаtоr (Visuаl Bаsiс) Subtrасts the vаlue оf аn exрressiоn frоm the vаlue оf а vаriаble оr рrорerty аnd аssigns the result tо the vаriаble оr рrорerty
b) or
‣In Рythоn, Lоgiсаl орerаtоrs аre used оn соnditiоnаl stаtements (either True оr Fаlse)
c) > =
‣greater than or equal to operator
d) = !
‣This operator symbol is incorrect, Correct one is ( !=)
▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
HOPE IT HELPS