fds6
def quick_sort(arr):
if len(arr) <= 1:
return arr
else:
pivot = arr[0]
less_than_pivot = [x for x in arr[1:] if x <= pivot]
greater_than_pivot = [x for x in arr[1:] if x > pivot]
return quick_sort(less_than_pivot) + [pivot] + quick_sort(greater_than_pivot)
def display_top_five(scores):
sorted_scores = quick_sort(scores)
top_five = sorted_scores[-5:]
return top_five
Example array of first-year percentages (you can modify this array)
first_year_percentages = [78.5, 86.2, 92.0, 81.7, 95.3, 89.1, 73.8, 90.5]
Displaying sorted array and top five scores
sorted_percentages = quick_sort(first_year_percentages)
print("Sorted First Year Percentages:", sorted_percentages)
top_five_scores = display_top_five(first_year_percentages)
print("Top five scores:", top_five_scores)