Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Program to replace lower-case characters with upper-case and vice versa in python

#Converting a given string's lower to upper case and Vise-versa
c = input()
i = 0
j = [] #Declaring empty List
for i in range(len(c)): #For Acessing elements in string. 
    if c[i]==c[i].lower(): #For finding the Lower-case or Upper-case elements
     j.append(c[i].upper()) #Adding the new chhanged Upper-case element to j
    else :
        j.append(c[i].lower()) #Adding the new changed Lower-case elements to j
f = ''.join([str(elem) for elem in j])  #converting list to String
print(f)
#sample input : Ashish
#sample output : aSHISH
Comment

how to convert uppercase to lowercase and vice versa in python

def swap_string():
	s=input()
	swapped_string=""
	swapped_string+=s.swapcase()
    return swapped_string
Comment

PREVIOUS NEXT
Code Example
Python :: dependency injection python 
Python :: python tkinter programming project ideas 
Python :: return the first occurence of duplicates pandas 
Python :: find index of value in list python 
Python :: topological sort 
Python :: python loop array 
Python :: pandas get rows which are NOT in other dataframe 
Python :: Accessing Elements from Dictionary 
Python :: list slice in python 
Python :: python sleep command 
Python :: python regeression line 
Python :: empty list check in python 
Python :: pandas pivot tables 
Python :: run python module from command line 
Python :: is there a null data type in python 
Python :: Python RegEx re.compile() 
Python :: make Python class serializable 
Python :: linkedlist python 
Python :: python power of natural number 
Python :: aws lambda logging with python logging library 
Python :: comments in python 
Python :: add header info in django response 
Python :: django-filter for multiple values parameter 
Python :: swarm plot 
Python :: how to separate numeric and categorical variables in python 
Python :: python calling method from constructor 
Python :: leetcode python 
Python :: vector data 
Python :: variable referenced before assignment python 
Python :: KeyError 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =