Functions · 24 / 27 Exercise Medium

Function to write text with title format

Objective

Create a Python program with a function called write_title_format() that writes a text centered on the screen, in uppercase, with a space between letters and a line above and below. Check the example output to see the format.

Instructions

  • In the main function, ask the user for a text.
  • Implement the function write_title_format() with the text as a parameter. It shows the text in uppercase, centered in a width of 20 characters, with a space between letters, and a line of - characters above and below.
Input
welcome!
Output
--------------------
  W E L C O M E !
--------------------

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise