text = input("Enter a string: ")
uppercase_text = text.upper()
lowercase_text = text.lower()
print("Uppercase:", uppercase_text)
print("Lowercase:", lowercase_text)
#source code --> clcoding.com
Code Explanation:
Take user input
input("Enter a string: ") → The user enters a string, which is stored in text.
Convert the string to uppercase
text.upper() → Converts all letters in text to uppercase.
Example: "hello" → "HELLO"
Convert the string to lowercase
text.lower() → Converts all letters in text to lowercase.
Example: "Hello WORLD" → "hello world"
Print the converted strings
print("Uppercase:", uppercase_text) → Displays the uppercase version.
print("Lowercase:", lowercase_text) → Displays the lowercase version.
Example Output
Input:
Enter a string: Python Programming
0 Comments:
Post a Comment