Question: def print_centered (text): that takes a string parameter text with a multi-line text, i.e., text that potentially contains ' ' line break characters. The

def print_centered (text): that takes a string parameter text with a multi-line text, i.e., text that

def print_centered (text): that takes a string parameter text with a multi-line text, i.e., text that potentially contains ' ' line break characters. The function prints the string centered and enclosed in a box of "*". For text with no line breaks (single-line), the function just prints the text in a box. For example, print_centered ("Python rocks!") should print: * Python rocks! create the following function: If the text contains multiple lines, each line will be centered and the entire text is enclosed in a box. For example, print_centered("Python is the best language!") should print: . Python is the best * language! * ******** You may NOT use the .center() string method. Hints: . If any line within the text starts or ends with spaces or tabs, you may need to remove them before you center the line. You can use the strip() string method to do that. In the same file, also create a main program that calls the print_centered function to print a multi-line text of your choice. You can hard-code the text in your program. This is just to demonstrate that your print_centered function works correctly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

I understand The question in the image is asking for a function that takes a string parameter text w... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!