+ 1
i need help!
why my code doesn't working text = input() dict = {} i=1 for x in set(text) : for y in text : if x==y : i+=1 dict[x]=i i=1 print(dict) dict[x]=i ^ IndentationError: unindent does not match any outer indentation level
6 Answers
+ 1
#I have spaced the dict[x] and i=1 lines so they can be inside the if. This solves the error, I hope it helps.
text = input()
dict = {}
i=1
for x in set(text) :
for y in text :
if x==y :
i+=1
dict[x]=i
i=1
print(dict)
+ 1
yes thanks guys it's work now , i try to create a program to take a string and count letter and put it in dict
+ 1
yeah it work,thank you ravilnicki
+ 1
ravilnicki thank you