Question: Write a function clean that when is given a string and returns the string with the leading and trailing space characters removed. Details: you

Write a function clean that when is given a string and returns

 

Write a function clean that when is given a string and returns the string with the leading and trailing space characters removed. Details: you must use while loop(s) you must not use the strip method the space characters are the space , newline ' ', and tab '\t' >>> clean(" 'hello' >>> clean (" hello, how are you? ") 'hello, how are you?' >>> clean (" \t what's up, doc? \t") hello ") "what's up, doc?" >>> clean(" \t what's up, doc? \t")=="what's up, doc?" True

Step by Step Solution

3.38 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can create a clean function that removes leading and trailing spaces n... 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!