i need help! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

2nd Feb 2022, 9:42 AM
Ahmed Chanane
Ahmed Chanane - avatar
4 Respostas
+ 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)
2nd Feb 2022, 9:45 AM
šŸ‡ Alex Tușinean šŸ’œ
šŸ‡ Alex Tușinean šŸ’œ - avatar
+ 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
2nd Feb 2022, 9:52 AM
Ahmed Chanane
Ahmed Chanane - avatar
+ 1
yeah it work,thank you ravilnicki
2nd Feb 2022, 10:01 AM
Ahmed Chanane
Ahmed Chanane - avatar
+ 1
ravilnicki thank you
2nd Feb 2022, 10:25 AM
Ahmed Chanane
Ahmed Chanane - avatar