I have written the following code to implemented the algorithm for $k$-fold cross-validation with a for loop as shown below (First piece of code), For the second pi
for