EPI 4.1 Primitive Types Variant question 2: Compute X mod a power of two

We are looking at question 4.1 from Elements Of Programming Interviews in Python book.

Write expressions that uses bitwise operators, equality checks and boolean operators to compute x mod a power of two. i.e. your program returns 13 for 77 mod 64.

If you are applying for software engineering positions I highly recommend getting this book.

Here is the video I created which walk you through the solution.