Python: Display an input string in upper and lower cases
Display input in upper and lower case.
Write a Python script that takes input from the user and displays that input back in upper and lower cases.

Sample Solution:
Python Code:
# Prompt the user to enter their favorite language and store the input in the variable 'user_input'.
user_input = input("What's your favorite language? ")
# Print the message "My favorite language is" followed by the user's input converted to uppercase.
print("My favorite language is ", user_input.upper())
# Print the message "My favorite language is" followed by the user's input converted to lowercase.
print("My favorite language is ", user_input.lower())
Sample Output:
What's your favourite language? english My favourite language is ENGLISH My favourite language is english
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Python program to take user input and display the text in both uppercase and lowercase formats.
- Write a Python program to accept a sentence and print it in all capital letters on one line and all small letters on another.
- Write a Python program to convert the input string into upper and lower case using the str.upper() and str.lower() methods.
- Write a Python program to implement a function that returns a tuple containing the upper and lower case versions of the input.
Python Code Editor:
Previous: Write a Python program to count the occurrences of each word in a given sentence.
Next: Write a Python program that accepts a comma separated sequence of words as input and prints the unique words in sorted form (alphanumerically).
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics