Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

string functions

#def function
--------------------------------------------------------------------------------
def fun(s):
    k=len(s)
    m=' '
    for i in range(0,k):
      
        if s[i].isupper():
            m=m+s[i].lower()
            
        elif s[i].isalpha():
            m=m+s[i].upper()
            
        else:
             if  s[i].isdigit():
                    m=m+ 'll'
             else:
                 if s[i].isspace():
                   m=m + 'e'
                    
                 else:
                     m=m + 'i'
   print(m)
  
fun('rag kI2sbra$n')
--------------------------------------------------------------------------------
#Output:

 '  RAGeKillSBRAiN   '
 
PREVIOUS NEXT
Tagged: #string #functions
ADD COMMENT
Topic
Name
6+7 =