Question
For this task, you are to write a function that takes a list of strings and prints them, one per line, in a rectangular frame.
For this task, you are to write a function that takes a list of strings and prints them, one per line, in a rectangular frame.
Note the following points about the frame:
* The first and last line only contains the character, asterisk ('*').
* All other lines start with an asterisk and a space, followed by the current string in the list, ending with appropriate number of spaces (minimum one) and another asterisk character.
For an empty list passed in as argument to your function, the function will not print any frame. It will just print an informative message on the screen.
_Hint: The number of trailing spaces that should be added for each string depends on the length of the longest string in the list. You could store the length of the longest string in a variable and use that variable as part of the format specifier in an f-string for printing the strings with appropriate number of trailing spaces._
#### Requirements
To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:
- You **must** print the strings of the list inside a for loop.
- You **must** address the scenario when an empty list is passed in as argument to your function
- You **must not** print the individual strings in the list using separate print statements.
- You **must not** add any code outside the `print_frame` function####
Example Runs
##### Run 1
Output for the list `['Put', 'this', 'on', 'my', 'tombstone']` :
The function should print the following output: * Hello * * World* * in* *a* * frame * ****
Step by Step Solution
3.38 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
Python version 38 def rectangularFramestrings Function that takes a list of strings and displays the ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started