[Solved] Can someone help me make my program case unsensitive? [closed]


The function lower returns the converted string and doesn’t convert the string self. You should use lower here:

splitted = my_string.lower().split()

Optimization for your code:

d = {}
l=[]
for i,j in enumerate(splitted):
    l.append(d.setdefault(j, i))


with open("numbertext.txt","w") as f:
    f.write(str(l))

solved Can someone help me make my program case unsensitive? [closed]