Challenge: Checking Specific Bits in an Unsigned Integer
Write a function that returns True if the specific number of bits starting from the specific position are on, and False otherwise.
We'll cover the following...
Consider an unsigned integer in which the rightmost bit is numbered as 0
. Write a function checkbits(x, p, n)
which returns True
if all n
bits starting from position p
are ...