Question: coding in PYTHON for very BEGINNERS Need help with fixing part (b) and solving part (c). Thank you. #a) def indent (string, numSp): ''' This

coding in PYTHON for very BEGINNERS

Need help with fixing part (b) and solving part (c). Thank you.

#a) def indent (string, numSp): ''' This function will indent a string by a certain number of spaces input: 1 text string and 1 number of spaces output: no (without a return) ''' print (numSp*" ", string)

indent("hello", 5)

#b) def center (string, width): ''' This function will center a string with respect to the screen width input: 1 text and 1 screen width output: 1 number of indentation spaces '''

lenString =len(string) indSpaces=((width - lenString)/2) return indSpaces

indent ("Hello, world", indSpaces)

numInd = center ("Hello, world", 100)

print("Indented by", indSpaces, "spaces")

#Hint: call the indent function to indent by t he appropriate number of spaces.

#c) This function must call one of the previous functions

def centeredBox (string, width): '''This function will print a string in a box that is centered in the screen width input: 1 text string and 1 screen width output: no '''

Example:

coding in PYTHON for very BEGINNERS Need help with fixing part (b)

centered Box ("1234", 80) 1234

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!