<prompt> Andika suluhisho la tatizo lifuatalo katika Python: Unapewa idadi kamili ya safu ya n ambayo ina vitu n, na k kamili. Tafuta safu ndogo inayofuatana ambayo urefu wake ni sawa na k ambayo ina thamani ya wastani wa juu na urudi thamani hii. Jibu lolote na kosa la hesabu chini ya 10-5 litakubaliwa.  <response>: Here is a solution in Python:def findMaxAveragenums, k: calculate the sum of the first k elements total_sum sumnums:k max_sum total_sum iterate through the rest of the array and calculate the sum of every k elements for i in rangek, lennums: total_sum numsi - numsi - k max_sum maxmax_sum, total_sum return the maximum average return max_sum kThis solution uses a sliding window technique to calculate the sum of the k elements. It first calculates the sum of the first k elements, then slides the window by adding the next element and subtracting the last element. It keeps track of the maximum sum and returns the result divided by k to get the maximum average. 