Header Ads

Accepts the sequence of lines as input and prints the lines in Python

Write a program that accepts the sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
Accepts the sequence of lines as input and prints the lines in PythonHello world
Practice makes perfect
Then, the output should be:
HELLO WORLD
PRACTICE MAKES PERFECT
Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
Solution:
lines = []
while True:
    s = raw_input()
    if s:
        lines.append(s.upper())
    else:
        break;
for sentence in lines:

    print sentence



Powered by Blogger.