Can anyone help me with my analyzer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

26th Jul 2019, 5:54 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
10 Answers
+ 1
Default you’re welcome :)
26th Jul 2019, 6:36 PM
Juho Pesonen
Juho Pesonen - avatar
+ 2
I did. Nothing changed.
26th Jul 2019, 6:15 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
+ 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?
26th Jul 2019, 6:20 PM
Daniele Bonomi
Daniele Bonomi - avatar
+ 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😅
26th Jul 2019, 6:33 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
+ 2
Thank you everyone for all the support and advice. It really means a lot to me. Hope you all have a wonderful day😀
26th Jul 2019, 6:35 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
+ 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
26th Jul 2019, 6:20 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
+ 1
Default I’m not getting any errors when I run your code. What type of error are you getting?
26th Jul 2019, 6:20 PM
Juho Pesonen
Juho Pesonen - avatar
+ 1
Goodester I'm getting the same number(percentage) for every letter
26th Jul 2019, 6:22 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
+ 1
Change the "for" loops with one another. Line 9 should be >>> for i in "poiuytrewqlkjhgfdsamnbvcxz": Line 11 should be >>> for j in text:
26th Jul 2019, 6:26 PM
Diego
Diego - avatar
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}%")
26th Jul 2019, 6:29 PM
Juho Pesonen
Juho Pesonen - avatar