# page no 349
# prob no 9.2
#calculate the efficiency
#given
Nd=7; N_start=1; N_stop=1.; N_parity=1;
#calculations
Nt= Nd + N_start+ N_stop + N_parity;
efficiency=Nd/Nt *100;
#results
print 'The efficiency is',efficiency,'%'
# page no 358
# prob no 9.6
#calculate the no. of hamming bits
#given
m=21.;
#calculations and results
# The correct number of check bits is the smallest number that satisfy the equation 2**n >= m+n+1;
for n in range (1,10): # we choose range of 1 to 10
a=m+n+1;
b=2**n;
if(b>=a):
print n,'hammming bits are required'
break;