python string

PYTHON

STRING:

A   String is  a  sequence  of  characters. A  characters  simply a symbol. For example ,the English language has 26 characters. ...In python ,a string is a sequence of Unicode characters. Unicode was introduced to include every character in all language and bring uniformity in encoding.

Built-in string Function in Python 

  • lower()-Converts all the characters of string to lowercase
         ex: var='HI PYTHON'

         print(var.lower())

        #hi python 

  • upper()-Converts all the characters of the string to uppercase
         ex:var='hello python'

        print(var.upper())

        #HELLO PYTHON

  • title()-Return the 'titlecased' version of string ,which means that all words strat with uppercase and the rest of the characters in words are in lowercase.

ex:a='welcome python'

print(a.title())

# Welcome Python

  • count(str[,beg[,end]])-Return the number of times substring 'str' occurs in the range[beg,end] if beg and end index are given else the search continue in full string search is case-sentive. 
ex: a='python'

str='o'

print(a.count())

#1

  • islower()-Return 'True' if all the characters in the string are in lowercase .if any of the char is in uppercase,it will return False.
ex: a='python'

print(a.islower())

#Ture

a='PYTHON'

print(a.islower())

#False

  • isupper()-Return 'True' if all the characters in the string are in uppercase .if any of the char is in lowercase,it will return False.

ex: a='python'

print(a.isupper())

#False

a='PYTHON'

print(a.isupper())

#True




         

     

Comments

Popular posts from this blog

dictionary blog surya

PYTHON LIST

Set blog surya