+ 2

Difference between (!=,==,=)?

3rd Apr 2019, 12:52 PM
Anonymous
Anonymous - avatar
7 Answers
+ 2
Is (=) is used with integers
3rd Apr 2019, 1:00 PM
Anonymous
Anonymous - avatar
+ 9
!= (Not equals to) is used as check inequality, i.e., if given operands are not same then it will return True, else False Ex: 5 != 6 Returns True ______________________________________ == (Equals to) is used as check equality, i.e., if given operands are same then it will return True, else False Ex: 5 == 6 Returns False ______________________________________ = (Assignment operator) is used to insert values in variables. Ex: name = "Zlytherin" Now the variable `name` contains "Zlytherin" as its value
3rd Apr 2019, 12:59 PM
Letsintegreat
Letsintegreat - avatar
+ 7
= (in fact, all three of them) can be used with any data type (integers, string, boolean etc.)
3rd Apr 2019, 1:01 PM
Letsintegreat
Letsintegreat - avatar
+ 3
'! =' two values are not equal to each other '==' compare two values '=' assign value to another variable
4th Apr 2019, 4:33 AM
Ashutosh Sharma
Ashutosh Sharma - avatar
+ 2
= adds a name sticker to a value. x = 5 y = 7 print(x, y) output: 5 7 == means 'equals' and != 'not equals'. 1 == 2 is False 1 != 2 is True.
3rd Apr 2019, 1:01 PM
HonFu
HonFu - avatar
+ 2
other than "==" and "=", you may also be confused with "==" and "is" "==" means their values (and also types) are the same, and "is" means they're exactly the same thing(or address in memory). The reason for integers can use "is" in most cases is because python stores each integer at a specific place in memory, and that's why they all point to the same address.
4th Apr 2019, 1:26 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 1
! =- > no equal to (conditional operater) == equal to operater( conditional operater) = assessment operator
27th Apr 2019, 11:26 AM
vijay
vijay - avatar