Answer: Provided in the explanation section
Explanation:
All  explanation to the code below are provided in the code comments
Code:
import numpy as np
# transition probability matrix
# copy all the values given
P = np.array([[92.07, 7.09, 0.63, 0.15, 0.06, 0.00, 0.00, 0.00],
[0.62, 90.84, 7.76, 0.59, 0.06, 0.10, 0.02, 0.01],
[0.05, 2.09, 91.38, 5.79, 0.44, 0.16, 0.04, 0.05],
[0.03, 0.21, 4.10, 89.37, 4.82, 0.86, 0.24, 0.37],
[0.03, 0.08, 0.40, 5.54, 83.24, 8.15, 1.11, 1.45],
[0.00, 0.08, 0.27, 0.34, 5.39, 82.41, 4.92, 6.59],
[0.10, 0.00, 0.29, 0.58, 1.55, 10.54, 52.80, 34.14],
[0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 100.0]])
print('Transition probability matrix:')
print(P)
print()
# probability transition for state 3
# extract 4th row for index 3
P3 = P[3]
print('Probability transition for state 3:')
print(P3)
print()
# probability that AAA company will not default in next 8 years
# for next 8 years, transition probabilities = P^8
P_next8 = np.linalg.matrix_power(P, 8)
# now get probability for transition from AAA to D
# and subtract it from 100 to get not default
P_next8_not_default = (100**8 - P_next8[0][7]) * 100 / 100**8
print('Probability that company rated AAA will not default in next 8 years:', P_next8_not_default)
cheers i hope this helps !!!