Mid2 14th_Character_Count_in_Listb
sentence=['s','t','r','i','n','g','s']
string=input("Enter a character: ")
count=0
for i in sentence:
if i==string:
count+=1
print(count)
#output:
Enter a character: s
2
sentence=['s','t','r','i','n','g','s']
Comments
Post a Comment