a='hi,how are you. i am nanda' .output:{'a':4, 'h':2----} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

a='hi,how are you. i am nanda' .output:{'a':4, 'h':2----}

construct a dict with key representing letters in a and values as count of the letter in a and values as count of the letter present in a.

11th Jul 2022, 9:18 AM
Gokul R
2 Answers
+ 6
You will need to show your attempt so we know how to help you. Providing finished codes for homework assignments are not encouraged here.
11th Jul 2022, 9:27 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
1- Create a empty dict. `b` 2- While iterating over `a` populate `b` with characters from `a` and their respective count number; for this : just explore the methods of string. 3- Return the ffinal dict.
11th Jul 2022, 11:44 AM
Ervis Meta
Ervis Meta - avatar