human
Solve the following python programming problem given the following code:
def check_fun_and_grads(fun, args, kwargs, argnums) : 
    wrt_args = [args [i] for i in argnums] 
    try : 
        if isinstance (fun, primitive) : 
            check_equivalent (fun (* args, ** kwargs), fun.fun (* args, ** kwargs)) 
except : 
        print ('Value test failed! Args were', args, kwargs) 
        raise 
with warnings.catch_warnings (record = True) as w : 
        try : 
            def scalar_fun(* new_args) : 
                full_args = list (args) 
                for (i, argnum) in enumerate (argnums) : 
                    full_args [argnum] = new_args [i] 
return to_scalar (fun (* full_args, ** kwargs)) 
check_grads (scalar_fun, * wrt_args) 
except : 
            print ('First derivative test failed! Args were', args, kwargs) 
            raise 
try : 
            for i in range (len (fun)) : 
                def d_scalar_fun(* args) : 
                    return to_scalar (grad (scalar_fun, argnum = i) (* args)) 
check_grads (d_scalar_fun, * wrt_args) 
except : 
            print ('Second derivative test failed! Args were', args, kwargs) 
            raise 

    
    

    Fix the buggy line: for i in range (len (fun)) :
assistant
#Here is Python program to fix the buggy line: for i in range (len (fun)) :
.

for i in range (len (argnums)) :