+ 5
Can anyone help me with my analyzer?
I am making a text analyzer and I can't seem to find the error in here. Help would be greatly appreciated. https://code.sololearn.com/c644xOMb2siP/?ref=app
10 Antworten
+ 1
Default you’re welcome :)
+ 2
I did. Nothing changed.
+ 2
I don't understand much your code (you should put more comments). Would you mind explaining the last part (from line 7)? What do you want achieve with this code?
+ 2
It's working now.
Guys this code was not working at first for some reason idk why I am very sure😅. I already tried some of the advice before they were even posted and it still didn't work. Idk why it's working now😅
+ 2
Thank you everyone for all the support and advice. It really means a lot to me.
Hope you all have a wonderful day😀
+ 1
Diego
It keeps on giving either the same percentage for every letter, or it gives the same letter to every percentage.
Depends on whether you put text in the former for loop or not
+ 1
Default I’m not getting any errors when I run your code. What type of error are you getting?
+ 1
Goodester I'm getting the same number(percentage) for every letter
+ 1
Change the "for" loops with one another.
Line 9 should be
>>> for i in
"poiuytrewqlkjhgfdsamnbvcxz":
Line 11 should be
>>> for j in text:
0
Default
that should do:
test_write = open("test","w")
test_write.write("owkdoddmsosnsjsjosksodkdienrucyskwldodgenfifj")
test_write.close()
with open("test","r") as f:
text = f.read()
for i in set(text):
print(f"{i} - {int(text.count(i) / len(text) * 100 - .5) + 1}%")