Join 36000+ teachers and students using TTIO.
Browse through the below operators. Try working with them yourselves (link to w3schools 'try it yourself' IDE included)
Assignment operators are used to assign values to variables:
Operator | Example | Same As | Try it |
---|---|---|---|
= | x = 5 | x = 5 | Try it » |
+= | x += 3 | x = x + 3 | Try it » |
-= | x -= 3 | x = x - 3 | Try it » |
*= | x *= 3 | x = x * 3 | Try it » |
/= | x /= 3 | x = x / 3 | Try it » |
%= | x %= 3 | x = x % 3 | Try it » |
//= | x //= 3 | x = x // 3 | Try it » |
**= | x **= 3 | x = x ** 3 | Try it » |
&= | x &= 3 | x = x & 3 | Try it » |
|= | x |= 3 | x = x | 3 | Try it » |
^= | x ^= 3 | x = x ^ 3 | Try it » |
>>= | x >>= 3 | x = x >> 3 | Try it » |
<<= | x <<= 3 | x = x << 3 | Try it » |
Comparison operators are used to compare two values:
Operator | Name | Example | Try it |
---|---|---|---|
== | Equal | x == y | Try it » |
!= | Not equal | x != y | Try it » |
> | Greater than | x > y |
www.teachyourselfpython.com