Runtime Error In Python Couldnt able to solve while submiting on the codeChef
<p>The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains two space-separated integers N and K denoting the number of measurements and the number of the greatest and the lowest values that will be removed.
The second line contains N space-separated integers A1, A2, ..., AN denoting the measurements.</p>

<p>For each test case, output a single line containing the average value after removing K lowest and K greatest measurements.</p>

<pre><code>var1=int(input("t:"))

while var1:

    list1=[]

    var2=int(input("n"))
    var3=int(input("k"))

    for i in range(var2):
        list1.append(int(input())) 

    list1.sort()

    print(list1)

    for i in range(var3):
        f=len(list1)
        list1=list1[1:f-1]

    sumOfList=sum(list1)

    total=0
    number=var2-(2*var3)
    total=sumOfList/number
    print("%.6f"%total)
    var1-=1
</code></pre>