+ 3
What is the difference between '=' and '==' operators
24 ответов
+ 25
Sameeksha Yadav
Single equal (=) is used to assign value
Double equal (==) is used to compare 2 values which will return true or false
+ 6
The triple equals operator (===) returns true if both operands are of the same type and contain the same value. If comparing different types for equality, the result is false.
+ 4
= is an assignment operator which is used to assign a value to any identifier whereas == is a logical operator used to compare the values.
+ 3
Brian ,
I was taking about Javascript & other lanaguages just to let you know there is a triple equal sign.
+ 2
= operator is for assigning value and == operator is for comparison of two values not there addresses
+ 2
Assignment operator (=) is used to assign values.
Comparison operator (==) is used to compare and returns 0 if false else 1.
+ 2
"=" is used for variables but "==" is mostly used for comparison operators
+ 2
= says, for example, a is assigned to b. b being a value(integer, float, string etc.) and a being the variable. a is set or assigned to the value b. But == falls more to the equality or inequality groups of comparisons meaning it returns True or False.
+ 2
== it compares two elements or two strings.it compares .if it is true then executes the block
(=) It is an assignment operator.
For a=2.it assigns a value to a .
b=a then b value also 2
+ 2
There's a subtle difference between the Python identity operator ( is ) and the equality operator ( == ). ... The == operator compares the value or equality of two objects, whereas the Python is operator checks whether two variables point to the same object in memory.
+ 2
You can also do the Python for Beginners tutorial
+ 1
Single equal to(=) is used to assign value
eg. a = 5;
Double equal to (==) is used to compare 2 values which will return true or false
eg. a == 10;(Think in mathematics terms so a = 10, but in programming language we use == to compare)
Does a = 10 is true or false because == is generally used for comparing the 2 values it will help in logical programs
+ 1
For example...
A = b means A assign the value.
A==b means A equal to B.
+ 1
For Purposes of ASSIGNMENT a value to variable we use =,and for comparing two variables we use ==
+ 1
#equal(=) used to assign value to variable.
name="Sameeksha"
# double equal (==) used to compare variable
#if name is "sameeksha" then print "Yes"
#if u change name value output will change to "No"
if name=="Sameeksha":
print("Yes")
else:
print("No")
#result :Yes
################
#here variable value changed
name="Solo Learn"
if name=="Sameeksha":
print("Yes")
else:
print("No")
#result:No
+ 1
= means Ur assigning a value
And
== Means Ur checking whether they are equal or not
eg..
a=10
b=20
c=a+b
if c==30
print("yes")
else
print("no)
output if yes
as a+b=10+20=30
0
Consider
x=1
Print(x)
You'll get output as 1
Wherein for double equal to (==) it compares the two values
If a==b:
The output gives false
And if both values are same it gives True and it applies same for both numericals and alphabets.
0
(1) (=) the single equal sign is called assignment operator in programming and its function is to assign a value to a variable in order to store the value into a particular variable.......for example
name = "Muhammad"
the assignment operator that appeared in between name and the value("Muhammad") is telling to compiler store the value("Muhammad") into the variable name.
(2) (==) the double equal sign is called equal operator in programming and its function is to compare two value, if the both value are equal it will output true otherwise false.....for example
a = 10
b = 20
if a == b:
print("True")
else:
print("False")
Output:
False
Because a and b are not equal, if they're equal the code will output True.