Boltzmann Partition Function Python Programming