We will build a Python programme A1Q2.py to display formatted messages in this problem.
Specifically:
1) Ask the users to input a string message which includes your name and a short message, i.e. ‘[Robert Kim] loves Hong Kong’. Make this entire message less than 40 characters, including your name. Put your name in the format: [first name] [Last name].
2) Ask users to input a positive integer that is greater than 40, which will serve as a field width subsequently.
3) Ask the user to input an alignment method [left, right or center].
4) Based on the following flow to write your code:
The sample output on different cases of input, the text in green indicates the user input or program output:
Alignment method
left
right
center
Wrong method
Output