Menu Close

Swap lower case and upper case characters

Create a program to swap the lower case and upper case characters in a given string. Get the input string and swap the lower case with upper case and vice versa and print the string.

string1=input("Enter any string with mixed upper and lower case characters: ")
string2=list(string1)
for i in range(len(string2)):
	if(string2[i].isupper()==True):
		string2[i]=string2[i].lower()
	else:
		string2[i]=string2[i].upper()

print("Changed String: {}".format("".join(string2)))

Input:
Enter any string with mixed case characters:  fCUKtHEcODE

Output:
Changed String:  FcukTheCode


Morae!Q!

->Insert and Extend in list python
->Print Odd Numbers in range
->Compare List in python
->Find whether the largest element in the array is at least twice as much as every other number in the array.
->Find minimum cost to reach the top of the floor
->Word Count in Python
->Lower case to upper case in python
->Display Time in python
->Sum of Odd And Even in Python
->Surface Area of Walls
->Find the sum of squares of individual digits
->Print the given series – 1 1 2 6 24
->Minimum number of steps required to reach destination.
->Seconds to Days Hours Minutes
->Program to remove add “Hyphen” character in the entered string
->Remove the nth Index Character from a Non-Empty String
->Relational operator Question
->Check whether all the given numbers lies in range of x and y.
->Find the Armstrong numbers between the given range.