#PYTHON BITWISE OPERATORS OPERATOR DESCRIPTION SYNTAX FUNCTION IN-PLACE METHOD & Bitwise AND a & b and_(a, b) __and__(self, other) | Bitwise OR a | b or_(a, b) __or__(self, other) ^ Bitwise XOR a ^ b xor(a, b) __xor__(self, other) ~ Bitwise NOT ~ a invert(a) __invert__(self) << Bitwise L shift a << b lshift(a, b) __lshift__(self, other) >> Bitwise R shift a >> b rshift(a, b) __irshift__(self, other)
Here is what the above code is Doing:
1. The first line of code is creating an array of random integers.
2. The second line of code is creating a mask of all the even numbers in the array.
3. The third line of code is creating a mask of all the odd numbers in the array.
4. The fourth line of code is creating a mask of all the numbers that are divisible by 3.
5. The fifth line of code is creating a mask of all the numbers that are not divisible by 3.
6. The sixth line of code is creating a mask of all the numbers that are divisible by 4.
7. The seventh line of code is creating a mask of all the numbers that are not divisible by 4.
8. The eighth line of code is creating a mask of all the numbers that are divisible by 5.
9. The ninth line of code is creating a mask of all the numbers that are not divisible by 5.
10. The tenth line of code is creating a mask of all the numbers that are divisible by 6.
11. The eleventh line of code is creating a mask of all the numbers that are not divisible by 6.
12. The twelfth line of code is creating a mask of all the numbers that are divisible by 7.
13. The thirteenth line of code is creating a mask of all the numbers that are not divisible by 7.
14. The fourteenth line of code is creating a mask of all the numbers that are divisible by 8.
15. The fifteenth line of code is creating a mask of all the numbers that are not divisible by 8.
16. The sixteenth line of code is creating a mask of all the numbers that are divisible by 9.
17. The seventeenth line of code is creating a mask of all the numbers that are not divisible by 9.
18. The eighteenth line of code is creating a mask of all the numbers that are divisible by 10.
19. The nineteenth line of code is creating a mask of all the numbers that are not divisible by 10.
20. The twentieth line of code is creating a mask of all the numbers that are divisible by 11.
21. The twenty-first line of code is creating a mask of all the numbers that are not divisible by 11.
22. The twenty-second line of code is creating a mask of all the numbers that are divisible by 12.
23. The twenty-third line of code is creating a mask of all the numbers that are not divisible by 12.
24. The twenty-fourth line of code is creating a mask of all the numbers that are divisible by 13.
25. The twenty-fifth line of code is creating a mask of all the numbers that are not divisible by 13.
26. The twenty-sixth line of code is creating a mask of all the numbers that are divisible by 14.
27. The twenty-seventh line of code is creating a mask of all the numbers that are not divisible by 14.
28. The twenty-eighth line of code is creating a mask of all the numbers that are divisible by 15.
29. The twenty-ninth line of code is creating a mask of all the numbers that are not divisible by 15.
30. The thirtieth line of code is creating a mask of all the numbers that are divisible by 16.
31. The thirty-first line of code is creating a mask of all the numbers that are not divisible by 16.
32. The thirty-second line of code is creating a mask of all the numbers that are divisible by 17.
33. The thirty-third line of code is creating a mask of all the numbers that are not divisible by 17.
34. The thirty-fourth line of code is creating a mask of all the numbers that are divisible by 18.
35. The thirty-fifth line of code is creating a mask of all the numbers that are not divisible by 18.
36. The thirty-sixth line of code is creating a mask of all the numbers that are divisible by 19.
37. The thirty-seventh line of code is creating a mask of all the numbers that are not divisible by 19.
38. The thirty-eighth line of code is creating a mask of all the numbers that are divisible by 20.
39. The thirty-ninth line of code is creating a mask of all the numbers that are not divisible by 20.
40. The fortieth line of code is creating a mask of all the numbers that are divisible by 21.
41. The forty-first line of code is creating a mask of all the numbers that are not