don't get why my code doesn't work...?

The assignment: Write a recursive function index_of_max(nums) that returns the index of the maximum value in the input list of numbers, leaving the original list unchanged.

Here's my code:
def index_of_max(nums):
if nums == []:
return "empty list" #base case 1
if len(nums) == 1:
return 0 #base case 2
else:
x = nums[0]
lst = nums[1:]
if x > index_of_max(lst):
return nums.index(x)
else:
return index_of_max(lst)

roger2016-02-23T18:42:41Z

try this
#include <stdio.h>
int getMax(int * n,int imx,int i){
if(!i) return imx;
if(n[i-1]> n[imx])
imx= i-1 ;
return getMax(n,imx,i-1);
}

int main(void){
int mx,imx;
int nelements;
int j[]={ 200,4,5,6,13,3 ,6,10,2,201};
nelements= sizeof j /sizeof *j;
imx=getMax(j,0,nelements);
printf(" %d %d\n", imx,j[imx]);
return 0;
}