def calcNXX(lens, percent):
 lenSum = sum(lens)
 threshold = ((float(percent) / 100) * lenSum)
 runningSum = 0
 nxx = 0
 nxxLen = 0
 for i in range((len(lens) - 1), (-1), (-1)):
  myLen = lens[i]
  nxx += 1
  runningSum += myLen
  if (runningSum >= threshold):
   nxxLen = myLen
   break
 return (nxx, nxxLen)

def calcNXX ( lens , percent ) : lenSum = sum ( lens ) threshold = ( ( float ( percent ) / 100 ) * lenSum ) runningSum = 0 nxx = 0 nxxLen = 0 for i in range ( ( len ( lens ) - 1 ) , ( - 1 ) , ( - 1 ) ) : myLen = lens [ i ] nxx += 1 runningSum += myLen if ( runningSum >= threshold ) : nxxLen = myLen break return ( nxx , nxxLen )
calculates any nxx statistic .