xonecas.io
387
Pe

python-exercices / files

python-exercices / level_two / ex_9.py

797 bytes
1#!/usr/bin/env python3
2
3# Question 9
4# Level 2
5
6# Question:
7# Write a program that accepts sequence of lines as input and prints the lines after making all
8# characters in the sentence capitalized.
9# Suppose the following input is supplied to the program:
10# Hello world
11# Practice makes perfect
12# Then, the output should be:
13# HELLO WORLD
14# PRACTICE MAKES PERFECT
15
16# Hints:
17# In case of input data being supplied to the question, it should be assumed to be a console input.
18
19
20def uppercase_sentences():
21    sentences = []
22    while True:
23        raw_text = input("Enter a sentence or leave blank to end\n")
24        if raw_text:
25            sentences.append(raw_text)
26        else:
27            break
28
29    [print(x.upper()) for x in sentences]
30
31
32if __name__ == '__main__':
33    uppercase_sentences()