+ 1
Letters counter
Please help with the lesson 1 of the first chapter of intermediate phyton. I made this: text = input() dict = {} #tu cĂłdigo va aquĂ x=list(text) for i in range(len(x)): y=x.count(x[i]) dict[i]={x[i]:y} print(dict) Can someone explain me what is wrong??
4 Answers
+ 5
Mabel Zavala Moreira ,
a bit late but I still want to share the code and some comments here.
first file: help for your issue
second file: description for a speed comparison using count() and othe methods for doinga character counter
third file: sample code according the discription
https://code.sololearn.com/cZ9t9oe3JV99/?ref=app
https://code.sololearn.com/cxlMm6Jjj0zF/?ref=app
https://code.sololearn.com/cMJUXDg4nb4u/?ref=app
+ 3
Mabel Zavala Moreira
I have attached a partial fix with comments below to assist you.
There is one part of the puzzle to complete
https://code.sololearn.com/c5zJLmZqpqjc/?ref=app
+ 2
I am also finding ways to shorten it
for t in text: dict[t] = text.count(t)
print(dict)
+ 1
# Good Luck
dict[x[i]]=y #dict[i]={x[i]:y}