Why we use double ==sign instead of single = sign. | SoloLearn: Learn to code for FREE!


Why we use double ==sign instead of single = sign.

side1 = int(input()) side2 = int(input()) side3 = int(input()) if side3**2==(side1**2)+(side2**2): print("Right-angled") else: print("Not right-angled")

3/3/2021 6:37:54 AM

Ali Tarique

3 Answers

New Answer


https://www.sololearn.com/discuss/1084542/?ref=app = is called assignment operator which assign a value example: a = 10, here we assign value 10 to variable a == is to check if equals, if a == b it means to check if a is equal to b As this is a duplicate question, please use search bar before posting your question https://www.sololearn.com/discuss/918660/?ref=app For reference: https://www.sololearn.com/learn/JavaScript/1132/


Ali Tarique Simple answer single = sign use to assign value like a = 2 double == sign use to check equality like 2==2 And also in some languages there is triple === sign which is use to check equality as well object type. For example 2 === '2' which is return false because 2 is int value and '2' is char value so value can be same but type is different.


single equal sign is used to set value while double equal sign is used to compare values a = 10 #a is 10 a = 12 #a is 12 now 3 == 4 #false because 3 is not equal to 4 a == 12 #true because a is equal to 12