for the further excersice there many way to do it and it’s fine to use your loop but you lost some of the readability of the code specially in the case when there only 2 elements it make me read the case of 2 then for next iteration it will use the first if which could be easier if you used the way in solutions also the solution has better performance i know it so little but as long as your code get bigger even little enhancement would help
in the solution it just write the result for the case of 2 element but for your case you need to loop twice
for
the Perimeter calcPerimeter method change the sides value beside calculated the perimeters you should not change the sides value
same issue as 1 and you did not call the calcPerimeter method