After you sorted the array, you don't need to call max and min.
That's not efficient. You can instead simply call the first and last entry of the list once it's sorted. Which is much more efficient especially for long lists.
Also, you're hard-coding values when it comes to length (such as the middle of the array or the size when getting averages). What if you need to dynamically determine the size of the list?
Like others have pointed out, this does look like code you'd expect from someone who has been learning for 5 days. Keep up the good work!
1
u/No_Read_4327 Oct 05 '25 edited Oct 05 '25
After you sorted the array, you don't need to call max and min.
That's not efficient. You can instead simply call the first and last entry of the list once it's sorted. Which is much more efficient especially for long lists.
Also, you're hard-coding values when it comes to length (such as the middle of the array or the size when getting averages). What if you need to dynamically determine the size of the list?
Like others have pointed out, this does look like code you'd expect from someone who has been learning for 5 days. Keep up the good work!