m learning python from the google tutorials. am stuck on an exercise related to lists. getting an index error
lis[j]=words.pop()[i]
IndexError: string index out of range
i need to sort the list but the words starting with x should be the first ones.
code is
def front_x(words):
i=0
lis=[]
j=0
k=0
words.sort()
while i<len(words):
if words[i][0:1]=="x":
lis[j]=words.pop()[i]
j+=1
i+=1
lis.extend(words)
while k<len(lis):
print(lis[k])
k+=1
return