human
Extract ' k ' bits from a given position in a number . | Function to extract k bits from p position and returns the extracted value as integer.
number is from where ' k ' bits are extracted from p position"
Solution in Python:
 Write me a code to extract ' k ' bits from a given position in a number?
assistant
#Here is code to extract ' k ' bits from a given position in a number .
 def bitExtracted ( number , k , p ) :
	return ( ( ( 1 << k ) - 1 ) & ( number >> ( p - 1 ) ) ) ;
number = 171
k = 5
p = 2
print " The ▁ extracted ▁ number ▁ is ▁ " , bitExtracted ( number , k , p )