Python script which take string as input from user and prints number of occurrences of character used in given string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python script which take string as input from user and prints number of occurrences of character used in given string

For ex., input string = "Python" p = 1 y = 1 t = 1 h = 1 o = 1 n = 1 Note:- please give all logics as many as possible

23rd Jan 2018, 4:31 AM
Devang Prajapati
Devang Prajapati - avatar
2 Answers
+ 2
text = input().lower() # make a set of unique letters then count them [print(k,'=',text.count(k)) for k in set(text)] https://code.sololearn.com/cmDZ8xM4cSg6/#py
23rd Jan 2018, 7:14 AM
richard