Answers for "convert all lowercase letters to uppercase letters and vice versa. in python"

5

converting capital letters to lowercase and viceversa in python

s=input()
new_str=""
for i in range (len(s)):
    if s[i].isupper():
        new_str+=s[i].lower()
    elif s[i].islower():
        new_str+=s[i].upper()
    else:
        new_str+=s[i]
print(new_str)
Posted by: Guest on April-11-2020
0

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
Posted by: Guest on May-26-2020
0

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
Posted by: Guest on November-02-2021

Code answers related to "convert all lowercase letters to uppercase letters and vice versa. in python"

Python Answers by Framework

Browse Popular Code Answers by Language