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 :: non blocking socket python 
Python :: uninstall python kali linux 
Python :: example exponential distribution python 
Python :: identify if a number is prime 
Python :: how to move an item from one list to another python 
Python :: printing hello world in python 
Python :: pytorch get tensor dimension 
Python :: how to convert r to python 
Python :: if something in something python example 
Python :: import messages 
Python :: how to add to end of linked list python 
Python :: how to make a operating system in python 
Python :: make guessing game by python 
Python :: division operators in python 
Python :: discord.py 8ball 
Python :: usage code grepper 
Python :: analyse des fleurs du mal la vision du baudelaire 
Python :: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrooom 
Python :: load text file line in listbox python tkinter site:stackoverflow.com 
Python :: forgot password miguel grinberg 
Python :: python replace list of ips from yaml file with new list 
Python :: python update pip windows 
Shell :: install imagick php ubuntu 
Shell :: postgres stop linux 
Shell :: how to start nginx in linux 
Shell :: Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE) 
Shell :: install ext-intl php7.4 ubuntu 
Shell :: install telnet alpine 
Shell :: ubuntu 20.04 install telegram 
Shell :: manjaro clean up disk space 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =