"center" function
Write a function named "center" that receives 2 parameters - "text"
(a string) and "width" (an int), and returns a string containing
"text" centered in a string of "width" length.
e.g. If you give the function text of "hello" and a width of 11, it
should return a string of " hello " (i.e. the text with 3 spaces
before and 3 spaces after - a total of 11 characters).
This function replicates Python's built in str.center() method -
see the documentation for further information and examples of how
it handles things, and don't use this function in your
solution...
If you have any doubts, please give me comment...
def center(text, width):
mid = width//2
mid_text = len(text)//2
l_padding = mid-mid_text
r_padding = l_padding
if(len(text)%2!=0):
l_padding-=1
if(width%2!=0):
l_padding += 1
return ' '*l_padding + text + ' '*r_padding
result = center('hello', 12)
print(result)

"center" function Write a function named "center" that receives 2 parameters - "text" (a string) and...