In [1]:

```
## Calculate the entropy increase
import math
del_h = 6.02 ## Heat added in kJ/mol
t_m = 273.15 ## mean temperature in kelvin
print("\n Example 2.1")
del_s = del_h*1e3/t_m
print"%s %.2f %s"%("\n Increase in entropy is ",del_s," J mol^-1 K^-1")
```

In [5]:

```
## Calculation of fraction of atoms with energy equal to or greater than 1eV at temperatures
import math
E = 1. ## energy in electron volt
e = 1.6e-19 ## charge on electron
k = 1.38e-23 ## constant
t1 = 300. ## temperature in K
t2 = 1500. ## temperature in K
print("\n Example 2.2")
print("\n\n Part A:")
n_N = math.exp(-(e/(k*t1)))
print"%s %.2f %s %.2e %s "%("\n Fraction of atoms with energy equal to or greater than 1eV at temperature ",t1," K is" ,n_N, " ") ## numerical value of answer in book is 2e-17
print("\n\n Part B:")
n_N = math.exp(-(e/(k*t2)))
print"%s %.2f %s %.2e %s "%("\n Fraction of atoms with energy equal to or greater than 1eV at temperature",t2," K is ", n_N," ") ## numerical value of answer in book is 4.3e4
#ans are converted into units
```