The theoretical definition of the probability is
![Pr=\frac{\text{the number of all favorable outcomes}}{\text{the number of all possible outcomes}}.](https://img.qammunity.org/2019/formulas/mathematics/middle-school/yynmwxipozv1jzryti9kgy4a7nz4fvke24.png)
1. The number of all possible outcomes.
You have 5 letters. The first letter of the code can be chosen in 5 ways, the second - in 4 ways, the third - in 3 ways, the fourth letter - in 2 ways and the last one - in 1 way. In total, the number of all possible outcomes is
![5\cdot 4\cdot 3\cdot 2\cdot 1=120.](https://img.qammunity.org/2019/formulas/mathematics/middle-school/frid8w0cq761l66svr6fjov9gezcrmatqg.png)
2. The number of all favorable outcomes.
If the code starts with M and ends with E, then you can change only second, third and fourth letters of the code. The second letter can be chosen in 3 ways (from letters A, F and R), the third letter - in 2 ways and the fourth letter - in 1 way. In total, the number of all favorable outcomes is
![3\cdot 2\cdot 1=6.](https://img.qammunity.org/2019/formulas/mathematics/middle-school/s8orf6s1vt0nloimppw6zru3pbg8sc3pb2.png)
Then the probability is
![Pr=(6)/(120)=(1)/(20)=0.05.](https://img.qammunity.org/2019/formulas/mathematics/middle-school/66xuz3vzw2ffgjro4c7errkf9bhc2w0mv2.png)