Hızlı yanıt: kod örneği
==
=
==
if a == 2: # Compares whether a is equal to 2 print a
- String with integer
- Integer with string
- String and float
- Float and string
.0
==
True
False
=
==
hi
=
hi = 2
hi
=
+
-
hi += 1hi -= 1
+=
-=
hi += 1 # is the same as hi = hi + 1hi -= 1 # is the same as hi = hi - 1
- is a comparison operator: returns
==
is the two items are equal, returnsTrue
if not, throws error if used to assign variable before definition and if the two items are not compatibleFalse
- is an assignment operator: will assign values like strings or numbers to variables. Can be used in forms like
=
when variable's value is a number and is already defined.+=
"hi = hello""2 == 3 probably returns False don't you think?"