The code below is one possible approach.
for n in range(1, 100): phi = 0 for k in range(1, n+1): a, b = n, k while b: a, b = b, a % b if a == 1: phi += 1 print(phi)