- Hacking Robots
- Posts
- Boring Python Basics (Tuesday) - Some new operators I did not know about
Boring Python Basics (Tuesday) - Some new operators I did not know about
This is extremely boring, but I did not know all the operators
For example:
3 // 2 = 1
This is different from
3 / 2 = 1.5
Btw
3 % 2 = 1
This also gives one, but it is different.
% - This returns a reminder
Membership operators
in and not in
‘x’ in ‘cat’
‘a’ not in ‘cat’
Identity Operators
is and is not
x = [1,2,3]
y = [1,2,3]
x is y → True
x is not y → False
I have no idea how bitwise operators work.
So far I have seen &, ^, `, ~, « and »
I have no experience with bitwise operators and don’t know how to use them.
Next is Math (Wednesday)