0

What ia the difference between a=2 and a==2 ?

I am not understanding what is the difference between a=2 and a==2. Please help me to do that.

26th Dec 2019, 1:35 AM
Twiddle
Twiddle - avatar
5 Respostas
+ 2
Hi Twiddle A = 2 You have just created a variable, which means, A, willbe acted upon by the code as if it was 2. Example: A * 6 = 12 A == 2 This is a comparison, which is asking, 'Is A the same as 2' If A=2, then A==2 is a true statement. If A = anything else, then A ==2 is a false statement
26th Dec 2019, 5:01 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Sorry, I didnt see python lang. in question 😁😉
26th Dec 2019, 5:23 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Use the searchbar, it has been asked many times.
26th Dec 2019, 1:37 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Maybe you mean a==2 and a===2 ?
26th Dec 2019, 5:16 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Ярослав Вернигора (Yaroslav Vernigora) it does not exist in python, there is only = and ==
26th Dec 2019, 5:20 AM
Aymane Boukrouh
Aymane Boukrouh - avatar