Python Exercise 9 Problem
In this Python exercise, write a Python program that will accept a few sentences as input from a user and print the sentences in upper case after user input. Take a look into the upper case function in Python and how to store values from user input.
For example, if the user supplied an input of I love Python programming, then the output should be I LOVE PYTHON PROGRAMMING.
Solution Python Exercise 9
Python Code Input:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | sentences = [] print("Please enter a few sentences: ") s = input() while True: if s: sentences.append(s.upper()) break else: break for sentence in sentences: print("Sentences after implementing the upper() function: ") print(sentence) |
User Input:
1 2 | Please enter a few sentences: I love to learn new functions and classes in Python. Python is a diverse object oriented programming language. |
Python Code Output:
1 2 | Sentences after implementing the upper() function: I LOVE TO LEARN NEW FUNCTIONS AND CLASSES IN PYTHON. PYTHON IS A DIVERSE OBJECT ORIENTED PROGRAMMING LANGUAGE. |