Program 4
4. Write a Python program to find length of string and to convert upper to lower case of a string
The function len() returns the length of a given string. The lower() converts the given string in
into lowercase and returns the string. The upper()converts the given string in into uppercase
and returns the string.
# User inputs the string and it gets stored in variable str
str = input("Enter a string: ")
print("Length of the input string is:", len(str))
str = input("Enter Upper Case string: ")
print(str.lower())
str = input("Enter Lower Case string: ")
print(str.upper())
OUTPUT:
Enter a string: Computer science
Length of the input string is: 16
Enter Upper Case string: BGSIT
bgsit
Enter Lower Case string: adichuchanagiri
ADICHUCHANAGIRI
Comments
Post a Comment