- 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.
2 ответов
+ 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.
+ 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.