Table of Contents
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:
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:
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:
Sentences after implementing the upper() function: I LOVE TO LEARN NEW FUNCTIONS AND CLASSES IN PYTHON. PYTHON IS A DIVERSE OBJECT ORIENTED PROGRAMMING LANGUAGE.