Python Program To Convert Character Cases
Write Python code to convert character cases
# WAP to convert a character from upper to lower and lower to upper case
upper = input("Enter the Upper Case Character :--> ")
asci = ord(upper) + 32
# can use upper.lower() instad of chr(asci)
print("Lower case of '" + upper + "' :--> " + chr(asci))
lower = input("\nEnter the Lower Case Character :--> ")
asci = ord(lower) - 32
# can use lower.upper() instad of chr(asci)
print("Upper case of '" + lower + "' :--> " + chr(asci))
Output:
Enter the Upper Case Character :--> D
Lower case of 'D' :--> d
Enter the Lower Case Character :--> q
Upper case of 'q' :--> Q