sorry if it is a stupid question, but I am new to programming and python. I have such code:
dic = {}
for word in text:
if word in dict:
dict[word] += 1
else:
dict[word] = 1
counter = 0
for key in sorted(dict, key = lambda x: dict[x]):
counter += 1
print(counter, key, dict[key])
I want this code to give me the frequency of the word tokens in the text in ascending order and it works. However, it is case-sensitive. I would like it to be case-insensitive. I was trying to use .lower() and unfortunately, it does not work. Can anyone help me, or suggest any solutions? Thank you for any suggestions,