def convert_from_bcd(bcd):
 (place, decimal) = (1, 0)
 while (bcd > 0):
  nibble = (bcd & 15)
  decimal += (nibble * place)
  bcd >>= 4
  place *= 10
 return decimal

def convert_from_bcd ( bcd ) : ( place , decimal ) = ( 1 , 0 ) while ( bcd > 0 ) : nibble = ( bcd & 15 ) decimal += ( nibble * place ) bcd >>= 4 place *= 10 return decimal
converts a bcd value to a decimal value .