+ 2

(solved) How to count letters in string using python

How to create a program that checks and outputs how many times ‘s’ comes in sicknesses please share the code

13th Feb 2021, 3:30 AM
Yusuf M Hashmi
11 Answers
+ 8
print('sicknesses'.count('s'))
13th Feb 2021, 3:32 AM
visph
visph - avatar
+ 4
Yusuf Hashmi If you want count of each character then you can try this https://code.sololearn.com/cebXGf11Gq58/?ref=app
13th Feb 2021, 4:53 AM
A͢J
A͢J - avatar
+ 3
Yusuf Hashmi I know what you wanted but I provided solution to count each character if you want.
13th Feb 2021, 5:08 AM
A͢J
A͢J - avatar
+ 2
and how do you tag each others names?
13th Feb 2021, 4:26 AM
Yusuf M Hashmi
+ 1
∆BH∆Y thanks: corrected ;)
13th Feb 2021, 4:24 AM
visph
visph - avatar
+ 1
thanks visph
13th Feb 2021, 4:25 AM
Yusuf M Hashmi
+ 1
what did you mean?
13th Feb 2021, 4:27 AM
visph
visph - avatar
+ 1
I Am AJ ! your code is also good but what i wanted was not this thanks
13th Feb 2021, 5:01 AM
Yusuf M Hashmi
+ 1
def letter_count(text, letter): #your code goes here return text.count(letter) text = input() letter = input() print(letter_count(text, letter))
9th Mar 2021, 12:27 AM
Aaron Siaw
Aaron Siaw - avatar