Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Use a dictionary. Loop over the letters Check if the current letter is in the dict as a key. If not, then add the letter with an initial value of 1. If yes then increment the value by 1. After the loop, output the dictionary. You can also use a Counter() object from the collections class, passing it the string and then converting to a dict for output.
26th Apr 2021, 7:50 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
hasnain siddiq89 First show your attempts. What you had tried.
27th Apr 2021, 9:46 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
Attempt
26th Apr 2021, 7:44 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 1
The code you tried
26th Apr 2021, 7:47 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 1
use len()
26th Apr 2021, 8:01 PM
Dayron Alexis Díaz Rodríguez
Dayron Alexis Díaz Rodríguez - avatar
0
Hint: Define a counter,define a item to find, iterate the objects and increase the counte every time, if the item is found.
28th Apr 2021, 8:17 AM
Sven_m
Sven_m - avatar