in python count() function is used to get total count of given element in a string. the counting starts from string starts to till end.
Ex.
str1 = "Saransh"
str_count = str1.count("a")
print("the count of 'a'is",str_count)
output
String len()
Ex.
in python count() function is used to get total count of given element in a string. the counting starts from string starts to till end.
Ex.
Comments
Post a Comment