Entropy Calculation In Python Code