1.

Write a note about count ( ) function in python?

Answer»
SyntaxDescriptionExample
count(str,beg,end)Returns the number of substrings occurs the given range.
Remember that substring may be a single character. Range (beg and end)  arguments are optional. if it is not given, python search is case sensitive.
>>>strl1="Raja Raja Chozhan"
>>>print(str1.count('Raj'))2
>>>print(str1.count('r'))0
>>>print(str1.count('R'))2
>>>print(str1.count('a'))5
>>>print(str1.count('a',0,5))2
>>>print(str1.count('a',11))1


Discussion

No Comment Found